Working through a non linear problem and i have no idea how he has reached the expansion from, i have wrote the question and the start of the solution which i am confused with, including the explanation given so far.
Question -
Let $A \in R^{m×n} $ with $m \geq n$ and $b \in R^n$. Prove: Point $\bar{x} \in R^n $ is a solution of the unconstrained optimization problem $$min\Vert Ax−b \Vert_{2}, x \in R ^n$$ if and only if $\bar{x}$ is a solution of the system of linear equations $$A^T Ax = A^T b$$
Solution -
$$f(x) := \Vert Ax - b \Vert_2 = ( x^T A^T A x - b^Tx-x^TA^Tb +b^Tb)^{1/2} $$ $$= ( x^T A^T A x -2 b^TAx+b^Tb)^{1/2}$$
The optimization problem is equivalent to minimizing the square of $f$, as $f(x)$ is positive $ \forall x \in R^{n} $and the quadratic function is increasing on $R_{+}$.