# Solving matrices with unknown constants?

I am struggling with solving systems of linear equations with unknown constants.

I can solve simple ones, such as:

In the following system, for which values of k would produce:

1. Infinitely many solutions?
2. No solution?
3. A unique solution? $$x + ky = 1\\ kx + y = 1$$
(where $k$ is some constant)

$$\left[ \begin{array}{cc|c} 1&k&1\\ k&1&1 \end{array} \right]$$

$$\text{Operation: } R2 \leftarrow R2 - R1$$

$$= \left[ \begin{array}{cc|c} 1&k&1\\ 0&1-k^2&1-k \end{array} \right]$$

Therefore:

a) If k = 1, there are infinitely many solutions:

$$= \left[ \begin{array}{cc|c} 1&1&1\\ 0&0&0 \end{array} \right]$$

b) if k = -1, there are no solutions:

$$= \left[ \begin{array}{cc|c} 1&-1&1\\ 0&0&2 \end{array} \right]$$

c) for any other values of k, we can do:

$$\text{Operation: } R2 = \frac1{(1-k^2)}R2$$

$$= \left[ \begin{array}{cc|c} 1&k&1\\ 0&1&\frac1{1+k} \end{array} \right]$$

But I can't figure out how to do this:

$$= \left[ \begin{array}{ccc|c} 1&-2&3&2\\ 1&1&1&k\\ 2&-1&4&k^2 \end{array} \right]$$

I try to put it into echelon form, but I end up with something that suggests there aren't any possible solutions:

$$= \left[ \begin{array}{ccc|c} 1&-2&3&2\\ 0&3&-2&k-2\\ 0&0&0&k^2-k-6 \end{array} \right]$$

Which was done by:

$$R2 \leftarrow R2 - R1$$ $$R3 \leftarrow R3 - 2R1$$ $$R3 \leftarrow R3 - R2$$

We conclude that the system will be consistent if $k^2 - k - 6 = 0$ (so $k = 3,-2$) and therefore, for these $k$, the system have infinitely many solutions. In all other situations, the equation $$0 = k^2 - k - 6$$ is a contradiction, so there are no solutions.