[proofplan]
We expand the squared norm $\|Ax - \alphax\|^2$ as a real-valued quadratic function of $\alpha \in \mathbb{C}$, then minimise by differentiating with respect to $\operatorname{Re}(\alpha)$ and $\operatorname{Im}(\alpha)$. The unique minimiser is $\alpha = (x^*Ax)/(x^*x) = r(x)$.
[/proofplan]
[step:Expand the squared norm as a quadratic in $\alpha$]
Let $x \in \mathbb{C}^n \setminus \{0\}$ and $\alpha \in \mathbb{C}$. Expanding:
\begin{align*}
\|Ax - \alphax\|^2 &= (Ax - \alphax)^*(Ax - \alphax) \\
&= x^*A^*Ax - \bar{\alpha}\,x^*Ax - \alpha\,x^*A^*x + |\alpha|^2\,x^*x.
\end{align*}
Writing $\alpha = a + ib$ with $a, b \in \mathbb{R}$, and setting $s := x^*Ax \in \mathbb{C}$ and $N := x^*x > 0$, this becomes
\begin{align*}
\|Ax - \alphax\|^2 = \|Ax\|^2 - 2a\,\operatorname{Re}(s) - 2b\,\operatorname{Im}(s) + (a^2 + b^2)N.
\end{align*}
[guided]
We expand using the sesquilinear property of the inner product in $\mathbb{C}^n$: $\langle u, v \rangle = u^*v$. The squared norm $\|u\|^2 = u^*u$ is always real and non-negative.
For the cross terms: $\bar{\alpha}\,x^*Ax = \bar{\alpha}\,s$ and $\alpha\,x^*A^*x = \alpha\,\bar{s}$ (since $(x^*Ax)^* = x^*A^*x$, so $x^*A^*x = \bar{s}$). Now $\bar{\alpha}\,s + \alpha\,\bar{s} = 2\operatorname{Re}(\alpha\bar{s})$. Writing $\alpha = a + ib$ and $s = \operatorname{Re}(s) + i\operatorname{Im}(s)$:
\begin{align*}
\operatorname{Re}(\alpha\bar{s}) = a\,\operatorname{Re}(s) + b\,\operatorname{Im}(s).
\end{align*}
Also $|\alpha|^2 = a^2 + b^2$. Combining these with the constant term $\|Ax\|^2 = x^*A^*Ax$ yields the quadratic expression in $(a, b)$.
[/guided]
[/step]
[step:Differentiate with respect to $\operatorname{Re}(\alpha)$ and $\operatorname{Im}(\alpha)$ and solve]
Setting the partial derivatives to zero:
\begin{align*}
\frac{\partial}{\partial a}\|Ax - \alphax\|^2 &= -2\operatorname{Re}(s) + 2aN = 0 \implies a = \frac{\operatorname{Re}(s)}{N}, \\
\frac{\partial}{\partial b}\|Ax - \alphax\|^2 &= -2\operatorname{Im}(s) + 2bN = 0 \implies b = \frac{\operatorname{Im}(s)}{N}.
\end{align*}
The Hessian matrix is $2N \cdot I_2$, which is positive definite since $N = x^*x > 0$. Therefore the critical point is a global minimum.
[guided]
The function $f(a,b) = \|Ax\|^2 - 2a\operatorname{Re}(s) - 2b\operatorname{Im}(s) + (a^2+b^2)N$ is a quadratic in two real variables. Its Hessian is
\begin{align*}
H = \begin{pmatrix} 2N & 0 \\ 0 & 2N \end{pmatrix} = 2N \cdot I_2.
\end{align*}
Since $N > 0$ (because $x \neq 0$), the Hessian is positive definite, confirming that the unique critical point is indeed a global minimum. The function is a paraboloid opening upward in $(a,b)$-space with a single minimum.
[/guided]
[/step]
[step:Reassemble $\alpha = a + ib$ and identify the Rayleigh quotient]
The optimal $\alpha$ is
\begin{align*}
\alpha = a + ib = \frac{\operatorname{Re}(s) + i\operatorname{Im}(s)}{N} = \frac{s}{N} = \frac{x^*Ax}{x^*x} = r(x).
\end{align*}
Therefore the Rayleigh quotient $r(x)$ is the unique scalar $\alpha \in \mathbb{C}$ that minimises $\|Ax - \alphax\|$.
[guided]
Why does this characterisation matter? It reveals that the Rayleigh quotient is not merely a convenient formula for approximating eigenvalues — it is the *optimal* scalar approximation to the action of $A$ on $x$. If $x$ is close to an eigenvector $w_i$, then $Ax \approx \lambda_i x$, and the Rayleigh quotient $r(x)$ is the scalar that makes this approximation best in the least-squares sense.
The computation itself is a standard calculus exercise: write $\alpha = a + ib$, differentiate the real-valued objective with respect to $a$ and $b$, and solve. Reassembling $\alpha = a + ib$ gives $\alpha = s/N = (x^*Ax)/(x^*x) = r(x)$.
Note that for Hermitian $A$, the Rayleigh quotient is always real (since $s = x^*Ax \in \mathbb{R}$ when $A^* = A$), and the minimisation reduces to a one-variable problem. The two-variable approach used here works for general (non-Hermitian) matrices.
[/guided]
[/step]