Explicit example of Hahn-Banach theorem on the finite dimensional space $\mathbb{R}^2$?

In case of $(\mathbb{R}^2, \|\cdot\|_2)$, things are quite simple.

Let $U \le \mathbb{R}^2$ be a subspace and $\phi : U \to \mathbb{R}$ a linear functional. By the Riesz representation theorem, there exists $a \in U$ such that $\phi(x) = \langle x, a\rangle, \forall x \in U$. Then the linear functional $\psi : \mathbb{R}^2 \to \mathbb{R}$ given by the same formula $\psi(x) = \langle x, a\rangle, \forall x \in \mathbb{R}^2$ is the unique Hahn-Banach extension of $\phi$.

Namely, clearly $\psi$ extends $\phi$ and $\|\phi\| = \|a\|_2 = \|\psi\|$ so $\psi$ is a Hahn-Banach extension of $\phi$.

Let $\zeta : \mathbb{R}^2 \to \mathbb{R}$ be another Hahn-Banach extension of $\phi$. By the Riesz representation theorem, there exists $b \in \mathbb{R}^2$ such that $\zeta(x) = \langle x, b\rangle,\forall x \in \mathbb{R}^2$. Since $\zeta$ extends $\phi$, we have

$$\langle x, a\rangle = \phi(x) = \zeta(x) = \langle x, b\rangle, \forall x \in U \implies \langle x, a - b\rangle = 0, \forall x \in U \implies a - b \perp U$$

Since $b = \underbrace{a}_{\in U} + \underbrace{(b - a)}_{\in U^\perp}$, the Pythagorean theorem gives

$$\|a\|_2^2 + \|b - a\|_2^2 = \|b\|_2^2 = \|\zeta\|^2 = \|\phi\|^2 = \|a\|_2^2 \implies b - a = 0 \implies a = b$$

Therefore $\zeta = \phi$.

This explicit construction is in fact always possible when dealing with a Hilbert space, which $(\mathbb{R}^2, \|\cdot\|_2)$ is an example of.


For an explicit example of the above discussion, consider the subspace $Y = \{(x,2x) \in \mathbb{R}^2 : x \in \mathbb{R}\} \le \mathbb{R}^2$ and the linear functional $\phi :Y \to \mathbb{R}$ given by $\phi(x,y) = x$.

An orthonormal basis for $Y$ is $\left\{\frac1{\sqrt{5}}(1,2)\right\}$ so the orthogonal projection $P_Y$ onto $Y$ is given by

$$P_Y(x,y) = \left\langle (x,y),\frac1{\sqrt{5}}(1,2)\right\rangle \frac1{\sqrt{5}}(1,2) = \left(\frac{x+2y}5, \frac{2x+4y}5\right)$$

Now notice that for all $(x,y) \in Y$ we have

$$\phi(x,y) = x = \langle (x,y), (1,0)\rangle = \langle (x,y), P_Y(1,0)\rangle = \left\langle (x,y), \left(\frac15, \frac25\right)\right\rangle$$

Now the above discussion implies that the unique Hahn-Banach extension of $\phi$ is given by $\psi : \mathbb{R}^2 \to \mathbb{R}$ defined as

$$\psi(x,y) = \left\langle (x,y), \left(\frac15, \frac25\right)\right\rangle = \frac{x}2 + \frac{2y}5, \quad\forall (x,y)\in\mathbb{R}^2$$