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. 
 A: Nice question.
You can go for the following approach : note that if $A,B$ are $n \times n$ matrices, each having columns summing to $p$, then the sum of all entries of $A$ and $B$ are both $np$ (number of columns times sum of each column).
Now, we calculate the sum of all entries of $AB$.
$$
\sum_{i,j=1}^n (AB)_{ij} = \sum_{i,j,k=1}^n A_{ik}B_{kj} = \sum_{j,k=1}^n B_{kj} \sum_{i=1}^n A_{ik} \\ = p \sum_{j,k = 1}^n B_{kj} = np^2
$$
where we note that $\sum_{i=1}^n A_{ik}$ is the sum of the $k$th column of $A$ which is $p$, and that $\sum_{j,k=1}^n B_{jk}$ is the sum of every entry of $B$, which is $np$.
Finally, suppose every column of $AB$ summed to $q$. Note that the sum of all entries of $AB$ is then $nq$. But we've seen it is $np^2$ above.
Therefore, $q = p^2$. In particular, if all columns of $AB$ summed to $p$, then $p = p^2$.
Which forces $p=0$ or $p=1$. I leave you to find matrices $A,B$ such that 


*

*$A,B,AB$ have every column summing to $0$.

*$A,B,AB$ have every column summing to $1$.
Think simple, the examples are easy!
A: 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.
A: If we denote $e = (1, 1, \ldots, 1)$ then the condition that all columns of a matrix $C$ sum to $p$ can be expressed as $eC = pe$.
Therefore, if $eA = pe$ and $eB = pe$, then
$$e(AB) = (eA)B = (pe)B= p(eB) = p^2e.$$
This is equal to $pe$ if and only if $p^2 = p$, which means $p=0$ or $p=1$.
