Given : $\begin{bmatrix} &1 &2 &1 &-1 \\ &2 &0 &t &0\\ &0 &-4 &5 &2 \end{bmatrix}$
Convert the given matrix to Echelon form.
Apply $R2\rightarrow R2 - 2R1$ $\begin{bmatrix} &1 &2 &1 &-1 \\ &0 &-4 &t-2 &2\\ &0 &-4 &5 &2 \end{bmatrix}$
Apply $R3\rightarrow R3\ -\ R2$ $\begin{bmatrix} &1 &2 &1 &-1 \\ &0 &-4 &t-2 & 2\\ &0 &0 &7-t &0 \end{bmatrix}$
It is given that the Rank is 2 which means the number of Linearly Independent Rows(or Columns) is 2 which is the number of pivots.
Here we already have two pivots which are 1 and -4.
$\therefore 7-t\ can't\ be\ a\ pivot$
$\Rightarrow 7-t=0$
$\Rightarrow t=7\ (ans)$