Is the system $y(n)=x(n^2)$ time invariant? According to my solution,

$$y(n) = x(n^2) \tag{1}$$ 

for $y(n,k)$ i.e output for delayed input $x(n-k)$

$$x_2(n) = x(n-k)$$

so $$y_2(n) = x_2(n) = x\big((n-k)^2\big)$$

and for delayed output signal $y_1(n)$, replace $n$ by $n-k$ in equation (1), so we get,

$$y_1(n) = x\big((n-k)^2\big)$$ and therefore system is time invariant

But in the answers to the book in which this question it says the system is time variant. Can anyone point out the mistake in my steps, and give correct way of solving this sum?
The system is obviously time-varying. However you make the following usual mistake in the first case of showing the response to the delayed input $x_2[n] = x[n-k]$ as follows.

Writing the output $y[n]$ in the formal manner: $$ y[n] = \mathcal{T}\{x[n]\} = x[n^2] $$ and denoting the shifted input as $$x_2[n] = x[n-k]$$ you would have the corresponding output $y_k[n]$ as:

$$y_k[n] = \mathcal{T}\{ x_2[n]\} = x_2[n^2] = x[n^2 -k] $$ which is defintely not equal to $y[n-k] = x[(n-k)^2]$ hence the system is time-varying. 

You should have defined the output as $$ x_2[n] = x[n-k] \implies x_2[n^2] = x[n^2 -k] $$ but you didn't. See that the equality sign between $x[n]$ and $x_2[n]$ enables you to operate on $n$ only, not the whole argument of both sides.