Solution (source code)

= Solution

For any $h$,
$$
\|A(c^*+h)-y\|_2^2
=\|Ac^*-y\|_2^2+2h^TA^T(Ac^*-y)+\|Ah\|_2^2.
$$
If the <normal equation> $A^TAc^*=A^Ty$ holds, the last two terms reduce to $\|Ah\|^2\geq0$, so $c^*$ minimizes. Conversely, at a minimizer the directional <derivative> in every $h$ vanishes, forcing $A^T(Ac^*-y)=0$.