Orthogonal expansion with eigenfunctions It's an eigenvalue problem.

$$y''+ y' + λy = 0$$ 
  $x$ is between $0$ and $1$.
$y(0) = y(1) = 0$

1) How can I find the orthogonal expansion of $f(x) = x$ on $[0,1]$, in terms of the eigenfunctions?
2) Find the smallest $N$ such that the weighted $L^2$ error between the $N$th partial sum,
$F_N(x)$ in previous part, and $f(x)$ is less than $0.1$.
Thank you so much
 A: If you multiply your equation by $e^{x}$, you get
$$
                   -\frac{d}{dx}e^{x}\frac{d}{dx}y =\lambda e^{x}y,\\
                           y(0)=y(1)=0.
$$
That's a Sturm-Liouville equation with weight factor $w(x)=e^{x}$. So the eigenfunctions form an orthonormal basis of $L^2_w[0,1]$. The equation $y''+y+\lambda y=0$ can be written as
$$
   \left(\frac{d^2}{dx^2}+\frac{d}{dx}+\lambda\right)y=0 \\
   \left(\frac{d}{dx}+\frac{1}{2}\right)^2+\left(\lambda-\frac{1}{4}\right)y=0 \\
     y(x)=Ae^{-x/2}\cos\left(\sqrt{\lambda-\frac{1}{4}}x\right)+Be^{-x/2}\sin\left(\sqrt{\lambda-\frac{1}{4}}x\right).
$$
The solutions where $A=0$ vanish at $x=0$, and those solutions vanish at $x=1$ iff
$$
               \sqrt{\lambda-\frac{1}{4}}=\pi,2\pi,3\pi,\cdots \\
                  \lambda = \frac{1}{4}+n^2\pi^2,\;\;\;\; n=1,2,3,\cdots.
$$
Then
$$
              u_n(x) = e^{-x/2}\sin(n\pi x)
$$
defines a complete orthogonal set of eigenfunctions in $L^2_{e^x}[0,1]$. The normalized eigenfunctions are
$$
       e_n(x)=\frac{1}{\|u_n\|_{e^x}}u_n = \frac{1}{\sqrt{\int_0^1\sin^2(n\pi x)dx}}u_n = \sqrt{2}u_n
$$
The Fourier series for $x$ with respect to the orthonormal basis $\{ e_n \}_{n=1}^{\infty}$ of $L^2_{e^x}[0,1]$ is
$$
           \sum_{n=1}^{\infty}(x,e_n)_{e^x}e_n=\sum_{n=1}^{\infty}\left(\int_0^1 te_n(t)e^t dt\right)e_n(x)
$$
The truncated series satisfies
$$
         \left\|\sum_{n=1}^{N}(x,e_n)_{e^x}e_n-x\right\|_{e^x}^2
           = \sum_{n=N+1}^{\infty}|(x,e_n)_{e^x}|^2
$$
So you need to compute $(x,e_n)_{e^x}$ and find $N$ large enough that the term on the right is strictly less than $0.1$. I'll leave it to you to find
$$
     (x,e_n)_{e^x} = \int_0^1 t(\sqrt{2}e^{-t/2}\sin(n\pi t))e^tdt
$$
