# Galerkin method, formulate the weak form, finite difference method for PDE

Consider the differential equation $$\frac{\text d^2 u}{\text d x^2} + \lambda_1 \frac{\text d u}{\text d x} + \lambda_2 u = -f(x),\quad\text{for}\quad x\in [a,b],$$ with boundary conditions $$u(a) = u(b) = 0,$$ where $\lambda_1$ and $\lambda_2$ are both constant. The function $f$ is a continuous function of $x$.

(a) Write down a weak formulation of this differential equation, including definitions of the inner product and the function space $V$ used.

I need help with formulating the weak form of this PDE. i have done it but not sure if it is correct,

my working:

$u_{xx} +\lambda_{1} u_x + \lambda_2 u = -f(x)$

inner product is defined as $\left< g,h\right> = \int_{a}^{b} g(x)h(x) dx$

choosing $v$ such that $v(a) = v(b) = 0$

$v \in V$ and $V = \lbrace v:v \text{ is continuous on } [a,b], \text{ piecewise continuous and bounded on } [a,b], v(a) = v(b) =0\rbrace$

multiply by $v$ and integrate over $[a,b]$

$\int_{a}^{b} v u_{xx} + \lambda_{1} \int_{a}^{b}\ v u_x + \lambda_{2}\int_{a}^{b} uv = \int_{a}^{b}-vf(x) dx$

using integration by parts i get

$[vu_x]_{a}^{b}- \int_{a}^{b}v_x u_x + \lambda_{1}[vu]_{a}^{b} - \lambda_{1}\int_{a}^{b}v_xu+ \int_{a}^{b}uv = \int _{a}^{b}-vf(x) dx$

write this in inner product form, using the above definition, and the fact that $v(a)=v(b)=0$

$\left< v_x,u_x\right> -\lambda_{1}\left< v_x, u\right> + \lambda_{2}\left<v,u\right> = -\left<v,f\right>$ is this correct?

also am not sure weather the second term in my expression is zero, or it should be included in this expression?

• No, it's not correct: watch out for the minus signs! Apart from this, it seems to me that there is no need for partial integration of the first order derivative. Then, according to my maybe rusty knowledge, the correct inner product form should become: $$- \left< v_x,u_x\right> + \lambda_{1}\left< v, u_x \right> + \lambda_{2}\left<v,u\right> = -\left<v,f\right>$$ – Han de Bruijn May 20 '18 at 19:48
• Thank you, you are correct, do you by any chance also know what the integral of the inner product of $< \phi_{1} ' , \phi_{2}'> = ?$ for example the inner product of $<\phi_{1}', \phi_{1}'> = \int_{0}^{1/3} 3^{2} + \int_{1/3}^{2/3} (-3)^ = 6$ – italy May 22 '18 at 18:59
• – Han de Bruijn May 23 '18 at 15:42