Can anybody explain orthogonal basis for constant polynomials? I have a problem.
$(f,g)= \int_{1}^{3} f(x)g(x) \, dx$ and $f(x)=\dfrac{1}{x}$ 
I have to find out a nearest constant polynomials to $f$.
So, I assumed $a$ to be a orthonormal basis for constant function, and by using inner 
product of $(a,a)$, which is $2a^2=1$ and I got $\pm \dfrac{1}{\sqrt{2}}$  for my 
orthonormal basis. But if it has a orthonormal basis, does that imply that it has also 
orthogonal basis too? but there is only one basis for constant function and I can not 
find any two basis that inner product of two would be zero.
Did I misunderstand something? 
two basis which  
 A: Since we're approximating $f$ by a constant function, and the space of constant functions is spanned by a single basis element, there's no reason to appeal (explicitly) to bases here.
Per the comments, we want to find the constant function $g(x) = c$ that minimizes the distance from $f(x) = \frac{1}{x}$ with respect to the given inner product, or in other words, find the constant $c$ that minimizes
$$(f - g, f - g) = \int_1^3 (f - g)^2 dx = \int_1^3 \left(\frac{1}{x} - c\right)^2 dx.$$
We can expand the integrand, integrate, then differentiate w.r.t. $c$, and solve to find its the optimal value of $c$, but it's slightly faster to differentiate w.r.t. $c$ first and then integrate (this comes at the cost of remembering and checking the condition that allows us to differentiate under the integral sign):
$$\frac{d}{dc}(f - g, f - g) = \frac{d}{dc}\int_1^3 \left(\frac{1}{x} - c\right)^2 dx
=\int_1^3 \frac{d}{dc}\left[\left(\frac{1}{x} - c \right)\right]^2 dx \\= \int_1^3 2\left(c - \frac{1}{x}\right) dx = \left. 2(cx - \log x)\right\vert_1^3 = 4c - 2 \log 3.$$ The quantity $(f - g, f - g)$ has a (uniquely) critical value where this expression is zero, namely at $c = \frac{1}{2} \log 3 = \log \sqrt{3}$.
(Strictly speaking needs to argue why this is a minimum rather than another sort of critical point. One way to do do this is to show that $$\left.\frac{d^2}{dc^2}\right\vert_{c = \frac{1}{2} \log 3} (f - g, f - g) > 0.)$$
Edit Alternatively, we can just project onto the subspace. If we abuse notation to let $c$ represent the function with constant value $c$, the projection of $f$ onto the subspace spanned by $c$ is
$$\frac{(f, c)}{(c, c)} c = \frac{\int_1^3 cf \,dx}{\int_1^c c^2 \,dx} c = \frac{c^2 \int_1^3 \frac{dx}{x}}{c^2 \int_1^3 dx} = \frac{\log 3}{2}$$
as desired. Note that if $c$ has using length, i.e., if $(c, c) = 1$, then the projection map simplifies to
$$f \mapsto (f, c) c.$$
In general, given an orthonormal basis $(w_1, \ldots w_m)$ of a vector subspace $W$ of an inner product space $(V, (\, \cdot\, , \,\cdot\,))$, the orthogonal projection onto $W$ has the simple formula
$$v \mapsto (v, w_1) w_1 + \cdots + (v, w_m) w_m,$$
and this map is independent of which basis $(w_a)$ of $W$ is used.
