In this paper we give the first deterministic polynomial time algorithm for testing whether a diagonal depth-3 circuit C(x1, . . . , xn) (i.e. C is a sum of powers of linear functions) is zero. We also prove an exponential lower bound showing that such a circuit will compute determinant or permanent only if there are exponentially many linear functions. Our techniques generalize to the following new results: