# Find the best approximation (in $L^2$ / mean-square sense) for $ln x$

The full statement of the problem is:

Consider the set of two functions $\{1,x\}$ on the interval $x\in[0,1]$. Replace the second function by another one in $span\{1,x\}$ which turns the pair into an orthogonal set. I did this, and found that $\{1, x - 1/2\}$ was an orthogonal set.

I'm not sure how to do part (b): Find the best approximation (in the mean-square or $L^2$ sense) to the function $ln x$ on (0,1) using this orthogonal set. Don't evaluate the integrals, just write expressions for coefficients.

So I did this by writing: $ln(x)=\sum_{n=0}^\infty c_n \phi_n(x) = c_0 + c_1(x-1/2)$ because $\phi_0=1$ and $\phi_1=x-1/2$ from what I wrote above. But then the coefficients $c_0,c_1$ are: $c_1=\int_{0}^{1}(x-1/2)lnxdx$ and $c_0 = \int_{0}^{1}ln(x)dx$. But isn't ln(x) undefined at x=0? Am I doing this problem correctly?

Edit: changed latex

• That is not an issue. $\log x$ is not defined at $x=0$ but the behaviour in a single point does not affect $\log x\in L^p(0,1)$ for any $p\in[1,+\infty)$. – Jack D'Aurizio May 13 '15 at 19:51

Being defined at a point for the function doesn't necessarily determine if the function itself will belong to $L^2(a,b)$. In your case, yes, the log is not defined at 0, but the integrals you have both have definite values. Also, for your Fourier coefficients, remember to divide by $<\phi_i, \phi_i>$.\$Doing so, and calculating your integrals (remember to take the limit of your lower bound as it goes to$0^+$) yields$c_0 = -1$and$c_1 = 3$. In the$L^2$sense implies that they want you to minimize the distance between both of those functions. So, you can look at it as so: Your integral is certainly an inner product, abstractly, since it satisfies the axioms of an inner product. So, we proceed: Imagine that you have already chosen an approximation for your function. Namely, you've found some$\epsilon$such that$||f - \sum_{n=1}^{\infty} a_n\phi_n||<\epsilon$. Now, you assume that the collection of all$\phi_n \neq 0$forms an orthogonal basis for the subspace you've chosen. Could you find a different set of constants that give an even better approximation? For simplicity I want to suppress the summation sign, here. $$f-a_n\phi_n = f-c_n\phi_n+(a_n-c_n)\phi_n$$ Now, we have this in the form of$u+v$. If we could prove$u$and$v$are orthogonal, then we can work with this. So, since all of our$\phi_n$are orthogonal, it is enough to show that$f$is orthogonal to anyone of these. Consider: $$<f - c_n\phi_n,phi_n> = <f,\phi_n> - c_n<\phi_n,\phi_n>$$ Using the definition of the Fourier coefficient here, you see that this is just 0. So, they are orthogonal, and can be rewritten as: $$||f - \sum_{n=1}^{\infty} a_n\phi_n||^2 = ||f - \sum_{n=1}^{\infty} c_n\phi_n||^2 + \sum_{n=1}^{\infty} (a_n-c_n)^2||\phi_n||^2$$ From which we can easily deduce that the best possible approximation, given an orthogonal basis, is with the Fourier coefficients. This is why you want to use the Fourier coefficients in your problem, since it is the best possible approximation. • Thanks for answering! If you've got time, why is that an approximation in the "$L^2$" sense? Seems like its just a Fourier approximation using the basis$\{1, x-1/2\}\$. – kmm May 13 '15 at 21:12