<s>[INST] Matrix equation using determinant This question got me thinking and confused on how to solve it.
If $$\begin{align}k(x-a)+2x-z&=0\\k(y-a)+2y-z&=0 \\ k(z-a)-x-y+2z&=0\end{align}$$ 
Show that $$x = \frac{ak(k+3)}{k^2+4k+2}.$$
So far so good, I could only solve it simultaneously.
 [/INST] Straightforward, using Cramer’s rule, see https://en.wikipedia.org/wiki/Cramer%27s_rule#Explicit_formulas_for_small_systems:
$$\begin{align}
{}&\det\begin{pmatrix}
2+k&0&-1\\
0&2+k &-1\\
-1&-1&2+k
\end{pmatrix}\\
&\qquad=(2+k)^2\det\begin{pmatrix} 
1&0&-1/(2+k)\\
0&1 &-1/(2+k)\\
-1&-1&2+k
\end{pmatrix}\\
&\qquad=(2+k)^2\det\begin{pmatrix}
1&0&-1/(2-k)\\
0&1 &-1/(2+k)\\
0&-1&2+k-1/(2+k)
\end{pmatrix}\\
&\qquad=(2+k)^2\det\begin{pmatrix}
1&0&-1/(2-k)\\
0&1 &-1/(2+k)\\
0&0&2+k-2/(2+k)
\end{pmatrix}\\
&\qquad=(2+k)^2(2+k-2/(2+k))\\
&\qquad=(k+2)(k^2+4k +2)=:D.
\end{align}$$
Now
$$\begin{align}
\det\begin{pmatrix}
ka&0&-1\\ ka &2+k&-1\\ ka &-1&2+k
\end{pmatrix}
&=ka\det\begin{pmatrix}
1&0&-1\\ 1&2+k&-1\\ 1&-1&2+k
\end{pmatrix}\\
&=ka\det\begin{pmatrix}
1&0&0\\ 1&2+k&0\\ 1&-1&3+k
\end{pmatrix}\\
&=ka(2+k)(3+k)=:D_x.
\end{align}
$$
Hence $x=D_x/D$ in case $k\notin\{-2,-2\pm\sqrt2\}$.
</s>