Questions on rank and invertability I'm working on some practice problems, and I'd like some feedback. 


*

*We have a n x n square matrix $A$ with rank $r$. There are other matrices $B$ and $C$ and $AB=AC$. I'm asked to find the maximal rank of $B-C$.


So in the case where $B = C$, the max rank would be 0. Now when is $B =/= C$? If A is zero, then AB = AC and r = 0. In that case, C could be 0 and B could be $I_n$, which would give a max rank of n.
I believe that makes sense, yeah? 

I'll expand on what I wrote in the comments. 
First, as your problem is stated, your solution is correct. For any matrix $A$, $AI_n=AI_n$ and $I_nI_n=I_n$ which has rank $n$. Since the rank of an $n \times n$ matrix cannot exceed $n$. The maximal rank of such a product of matrices, $BC$, is $n$. Rank of $A$ is not really relevant which makes me think you've possibly miss-copied part of this problem.
Your second attempt doesn't work. You cannot use $A^{-1}$ to cancel off $A$ in the equation $AB=AC$ since $A^{-1}$ exists only if you make the additional assumption $\mathrm{rank}(A)=r=n$.
Next, it is not generally the case that $\mathrm{rank}(B)=\mathrm{rank}(B^2)$. Consider for example: 
$$ B = \begin{bmatrix} 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix} $$
Notice that $\mathrm{rank}(B)=1$ whereas $B^2=0$ so $\mathrm{rank}(B^2)=0$.
Edit: For the new problem.
$AB=AC$ is equivalent to $A(B-C)=0$. Thus the rank of $B-C$ is bounded above by the number of linearly independent solutions of $Ax=0$ (this is the nullity of $A$: $n-r$). To the max rank of $B-C$ is less than or equal to $n-r$. To see that we can achieve this bound: Let $B$ be a matrix whose columns form a basis for $N(A)$ plus some zero columns to pad out $B$ to it's square. Then $AB=0$ (since $B$ is made of zero columns and elements of the nullspace of $A$). So, letting $C=0$, we get $AB=0=A0=AC$ where $B-C=B-0=B$ whose rank is the nullity of $A$: $n-r$. Thus the max rank of $B-C$ is $n-r$.
