The fact that $n=3$ comes from inspection.
In order for $f:\mathbb{R}^3\to\mathbb{R}^3:(x,y,z)\mapsto(x-z,y,az^2)$ to be a linear operator you need
$f(\vec{x}+\vec{u})=f(\vec{x})+f(\vec{u}), \quad\text{or}$
$\forall \vec{x},\vec{u}\in\mathbb{R}^3:\quad\begin{cases}(x+u)-(z+w)=(x-z)+(u-w) \\ (y+v)=(y)+(v) \\ a(z+w)^2=az^2+aw^2.\end{cases}$
(Note: $\vec{x}=(x,y,z),\vec{u}=(u,v,w)$ here.) The first two check out but the last one implies $2azw=0$ for all $z,w\in\mathbb{R}$, which is obviously false unless $a=0$.
Now we have that the matrix associated to $f$ as a linear map is given by
$f:\begin{pmatrix}x\\y\\z\end{pmatrix}\mapsto x\begin{pmatrix}1\\0\\0\end{pmatrix}+y\begin{pmatrix}0\\1\\0\end{pmatrix}+z\begin{pmatrix}-1\\0\\0\end{pmatrix}\quad\text{hence}\quad f(\vec{x})=\begin{pmatrix}1&0&-1\\0&1&0\\0&0&0\end{pmatrix}\vec{x}.$
Finally, to find $\mathrm{Ker} f$, solve $x-z,y,0=0$, which is parametrized by $(t,0,t)$ and hence $\mathrm{dim}=1$.