# Finite difference method for BVP (2nd order) [duplicate]

Possible Duplicate:
Two-Point boundary value problem

Given $-{d^2u \over dx^2} =0$ with $u(0)=\alpha, u(1) = \beta$. We can get a finite difference approximation by taking $U^0 =\alpha$ and $U^4=\beta$ and using $$\frac{1}{h^2}\left(U^{n+1}+U^{n-1}-2U^n\right) =0$$ for $n=1,2,3$ and $h=1/4$.

Then we get a system of linear equations which can be written as $\left(\begin{array}{ccccc} 1 & 0 & 0 &0 &0 \\ 16 & -32 & 16 &0 &0\\ 0 & 16 & -32 &16 &0\\ 0 & 0 & 16 &-32 &16\\ 0 & 0 & 0 &0 &1\end{array} \right) \cdot \left(\begin{array}{c} U^0 \\ U^1 \\ U^2 \\ U^3 \\ U^4 \end{array} \right) = \left(\begin{array}{c} \alpha \\ 0 \\ 0 \\ 0 \\ \beta \end{array} \right)$

which we can solve by gaussian elimination.

But what happens if I am asked to construct a 2nd order finite difference approximation to the BVP $$-{d^2u\over dx^2} + {du\over dx} =x$$ with $u(0)=\alpha, u(1) = \beta$? Can I still use the formula $$\frac{1}{h^2}\left(U^{n+1}+U^{n-1}-2U^n\right) =0$$? But then wouldnt I get the same answer? But it is a different differential equation.