Find all conditions of a and b for when matrix has determinant zero Find all conditions on a and b for which A =
\begin{bmatrix} a & 0 &a^2 \\ 2 & a & 3a \\ a & -1 & ba+b\end{bmatrix} 
has determinant 0.

Let $A$ be the matrix$$\begin{pmatrix} a & 0 & a^2 \\ 2 & a & 3a \\ a & -1 & ab + b \end{pmatrix}.$$
If $a=0$, then 
$$\det\begin{pmatrix} a & 0 & a^2 \\ 2 & a & 3a \\ a & -1 & ab + b \end{pmatrix} = \det\begin{pmatrix} 0 & 0 & 0 \\ 2 & 0 & 0 \\ 0 & -1 &  b \end{pmatrix},$$
which is obviously 0 from the first row. So, assume that $a\ne 0$ and compute via row-reduction as follows:
$$\det \begin{pmatrix} a & 0 & a^2 \\ 2 & a & 3a \\ a & -1 & ab + b \end{pmatrix}=\det \begin{pmatrix} a & 0 & a^2 \\ 0 & a & a \\ 0 & -1 & ab + b - a^2 \end{pmatrix} = \det \begin{pmatrix} a & 0 & a^2 \\ 0 & a & a \\ 0 & 0 & -a^2 + ab + b +1 \end{pmatrix}.$$
Therefore, we have
$$\det(A)=0 \iff a=0 \mbox{ or }a^2(-a^2+ab+b+1)=0 \iff a=0 \mbox{ or } -a^2+ab+b+1=0.$$
Doing a bit of algebra, we have the following solutions:

$$\det(A)=0 \iff a=0, a=-1 \mbox{ or } b=a-1 .$$

