You can also consider the 3 dimensional vector space $V$ of functions that map the set $S = \{1,2,3\}$ to the real numbers. The functions $f_1(x) = 1$, $f_2(x) = x$ and $f_3(x) = x^2$ restricted to $S$ are 3 linear independent elements of $V$. Let's define an inner product on $V$:
$$a\cdot b = \sum_{k=1}^{3}a(k) b(k)$$
Then we can construct an orthonormal basis using the functions $f_j(x)$ using the Gram-Schmidt method. We start by normalizing $f_1$ to obtain our first basis vector:
$$e_1(x) = \frac{f_1(x)}{|f_1|} = \frac{1}{\sqrt{3}}$$
We then subtract from $f_2$ the component in the direction of $e_1$:
$$g_2(x) = f_2(x) - (f_2\cdot e_1)e_1(x) = x - 2$$
Normalizing $g_2$ gives us our next basis vector:
$$e_2(x) = \frac{1}{\sqrt{2}}(x-2)$$
Subtracting the components of $f_3$ in the subspace spanned by $e_1$ and $e_2$ yields:
$$g_3(x) = f_3(x) - (f_3\cdot e_1)e_1(x) - (f_3\cdot e_2)e_2(x) = x^2 - 4 x +\frac{10}{3} $$
Normalizing $g_3$ yields the final basis vector:
$$e_3(x) = \sqrt{\frac{3}{2}}\left(x^2 - 4 x +\frac{10}{3}\right)$$
We can now expand the function $f(x)$ in this orthonormal basis:
$$f(x) = \sum_{r=1}^3 (f\cdot e_r) e_r(x) = x^2 + x + 1$$