Maximization problem in order to find the norm of a linear functional. I was looking for motivation behind Hahn-Banach theorem in functional analysis.So,for a start,I looked at the case when the normed linear space is $X=\mathbb R^2$ and $X_0=\mathbb R\times\{0\}\simeq \mathbb R$ is a subspace.Suppose I consider the functional $f:\mathbb{R\to R}$ defined by $f(x)=2x$ ,clearly this functional has $||f||=2$.Now I am trying to see if I can extend this functional to a functional $g:\mathbb{R^2\to R}$ such that $g|_{X_0}=f$ and $||g||=||f||$.Now $||g||=\sup\limits_{||(x,y)||=1} |g(x,y)|$.Now if I let $g(x,y)=2x+ay$ ,then finding norm of $g$ is equivalent to maximizing $|g(x,y)|=|2x+ay|$ subject to the constraint $x^2+y^2=1$.Now I have to find $M(a)=\max\limits_{x^2+y^2=1}{|2x+ay|}$ and find $a$ such that $M(a)=2$.Thus I can find a suitable extension of $f$ such that the norm is preserved.But I do not know how to solve this maximization problem and the calculations seem to be tedious.Is there any systematic way to solve such problems?Also my question is that is there any simple way to calculate the norm of a linear functional $f(x_1,x_2,...,x_n)=a_1x_1+...+a_nx_n$?If there is such a method,then please illustrate with an example.
 A: Here's a quick trick: from general Hilbert space theory, if $H$ is a Hilbert space and $\xi\in H$ is a vector, then $\phi:H\to\mathbb{R}$ given by $\phi(x)=\langle x,\xi\rangle$ is a bounded linear functional with $\|\phi\|=\|\xi\|$ (you can easily show this yourself).
The functional $f:\mathbb{R}^n\to\mathbb{R}$ given by $f(x_1,\dots,x_n)=a_1x_1+\dots+a_nx_n$ is nothing but the functional $f(\vec{x})=\langle\vec{x},\vec{a}\rangle_{\mathbb{R}^n}$, so $$\|f\|=\|\vec{a}\|_{\mathbb{R}^n}=\bigg(\sum_{j=1}^n|a_j|^2\bigg)^{1/2}.$$
Alternative approach
We can also verify this using Lagrange's multiplier method, but it takes a few calculations. Let's do that: assume that $(a_1,\dots,a_n)\ne0$.
We need to find the critical points of $f(\vec{x})$ subject to the constraint $\vec{x}\in\mathbb{S}^{n-1}$, which can be restated as $g(x_1,\dots,x_n)=0$, where $g(x_1,\dots,x_n)=\sum_{j=1}^nx_j^2-1$. Let $\lambda\in\mathbb{R}$. We need to solve the system of equations
$$(\nabla f-\lambda\nabla g)(x_1,\dots,x_n)=0$$
$$g(x_1,\dots,x_n)=0.$$
If $\lambda=0$, this is impossible. For $\lambda\ne0$, this has a unique solution, namely $(x_1,\dots,x_n)=(\frac{a_1}{2\lambda},\dots,\frac{a_n}{2\lambda})$ and $\lambda=\frac{1}{2}\big(\sum_{j=1}^na_j^2\big)^{1/2}$. So, the maximum of $f$ is equal to $$f(\frac{a_1}{2\lambda},\dots,\frac{a_n}{2\lambda})=\big(\sum_{j=1}^na_j^2\big)^{-1/2}\cdot\big(\sum_{j=1}^na_j^2\big)=\big(\sum_{j=1}^na_j^2)^{1/2}$$
