I want to show that $$ \sup_{(x,y)\in \mathbb{R}^2 \setminus \lbrace (0,0) \rbrace} \frac{(ax+by)^2}{x^2+y^2} =a^2+b^2 $$ where $a,b \in \mathbb{R}$ are fixed (this problem appears when one tries to estimate the operator norm of functionals from $\mathbb{R}^2 \to \mathbb{R}$ which all have the form $(x,y) \mapsto ax+by$).
One way to do this is to compute the partial derivatives (which I did) to see that they both vanish at $y=\frac{b}{a}x$ and $y=-\frac{a}{b}x$. Plugging these value into the function, one indeed obtains $a^2+b^2$.
The downside of this approach is that one would also have to show that the function is concave and tends to $-\infty$ for $x,y \to -\infty$ in order to see that these are actually maxima.
Another way would presumably be to plugin in $x=1$ and $y=\frac{b}{a}$ to see that "$\geq$" holds and to somehow estimate $"\leq$"
Can someone help me with one of the approaches above or -even better- point me to a more elegant way of doing this?
The quickest way is to note that
$$\sup_{(x,y)\in\mathbb{R}^2\setminus \{(0,0)\}} \frac{(ax+by)^2}{x^2+y^2} = a^2 + b^2$$
is just the Cauchy-Schwarz inequality for the standard inner product on $\mathbb{R}^2$.
Without using that, one can observe that $f(x,y) = \frac{(ax+by)^2}{x^2+y^2}$ is homogeneous of degree $0$, i.e. $f(tx,ty) = f(x,y)$ for all $t > 0$. Thus one wants to find the maximum of $f$ on the unit circle $\{(x,y) : x^2+y^2 = 1\}$, and can use e.g. the method of Lagrange multipliers or a parametrisation $(\cos\varphi,\sin\varphi)$ of the unit circle to find the maximum. For the Lagrange multipliers, we get
$$(ax+by)\cdot (a,b) = \lambda\cdot (x,y),$$
so the extrema are at the points where $ax+by = 0$ - these are minima - and where $(x,y)$ is a multiple of $(a,b)$ (unless $a = b = 0$, in which case $f \equiv 0$ is obvious anyway), which are maxima.