If A and B are $n \times n$ matrices where each column sums to p. Then for what values of p will the matrix AB also have all columns that sum to p? I have no idea how to approach this question. I've tried working through it with sum notation but it became jumbled. I assume there's another property of matrices that I can use to make this simpler? Since using the basic properties of matrix multiplication seems convoluted. Using generic 2x2 matrices, I was able to find that for p=0 and p=1 AB has columns that add to p. But I'm unsure on how to do this working for a generic nxn matrix. 

The sum of the $k$-th column of $AB$ when each column of $A$ and $B$ add up to $p$ is
$$
\sum_{j=1}^n[AB]_{j ,k}=\sum_{j=1}^n\langle [A]_{j,\bullet },[B]_{\bullet ,k} \rangle=\left\langle \sum_{j=1}^n [A]_{j,\bullet },[B]_{\bullet ,k}\right\rangle\\
=\langle (p,p,\ldots ,p),[B]_{\bullet ,k} \rangle=\sum_{j=1}^n p[B]_{j,k}=p\cdot p=p^2
$$
where $[C]_{\bullet ,k}$ is the $k$-th vector column of matrix $C$, $[C]_{j,\bullet }$ is the $j$-th vector row of matrix $C$, $[C]_{j,k}$ is the $(j,k)$-coefficient of matrix $C$ and $\langle  \cdot ,\cdot \rangle$ is the Euclidean dot product.
Then the solutions are the $p\in \mathbb C $ such that $p=p^2$, that is, zero and one.
