Found this exercise in Serge Lang's Introduction to Linear Algebra:
Find the rank of the matrix $$\begin{pmatrix} 1 &1 &0 &1 \\ 1 &2 &2 &1 \\ 3 &4 &2 &3 \end{pmatrix}$$
So my process to solve it is as follows. First, I set a system
$$ x \begin{pmatrix} 1 \\ 1 \\ 0 \\ 1 \end{pmatrix} + y \begin{pmatrix} 1 \\ 2 \\ 2 \\ 1 \end{pmatrix} + z \begin{pmatrix} 3 \\ 4 \\ 2 \\ 3 \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 0 \end{pmatrix} $$
$$\begin{cases} x + y + 3z = 0 \\ x + 2y + 4z = 0 \\ 2y + 2z = 0 \\ x + y +3z = 0 \end{cases}$$
Immediately we see that we can ignore the last equation. Then we can subtract the first one from the second one so we get
$$\begin{cases} x + y +3z = 0 \\ y + z = 0 \\ 2y + 2z = 0 \end{cases}$$
The third one is $2$ times the second one so we can remove it. Finally we have $$\begin{cases} x + y +3z = 0 \\ y + z = 0 \\ \end{cases}$$
Since this is a system of two equations in three unknowns, it has a non-trivial solution and thus, both are linearly dependent. Therefore, the rank is $1$
I must have made some mistake since the answers at the back of the book state that the solution is $2$ but I don't see where I'm wrong
Thanks to the comments I found that I just have to reduce it to row echelon form, I guess I misunderstood ranks, the answer is
$$\begin{aligned} \begin{pmatrix} 1 &1 &0 &1 \\ 1 &2 &2 &1 \\ 3 &4 &2 &3 \end{pmatrix} &\overset{(2) - (1)}{\implies} \\ \begin{pmatrix} 1 &1 &0 &1 \\ 0 &1 &2 &0 \\ 3 &4 &2 &3 \end{pmatrix} &\overset{(3)-3\cdot (1)}{\implies} \\ \begin{pmatrix} 1 &1 &0 &1 \\ 0 &1 &2 &0 \\ 0 &1 &2 &0 \end{pmatrix} &\overset{(3) - (2)}{\implies} \\ \begin{pmatrix} 1 &1 &0 &1 \\ 0 &1 &2 &0 \\ 0 &0 &0 &0 \end{pmatrix} \end{aligned}$$
Then, since it's in row echelon form it's clear that these are two linearly independent equations