# Using Galerkin's method to find an approximate solution

How we can use Galerkin's method to find an approximate solution of

\begin{align} x''(t)+ tx(t) &= 1, \\ x(0) &= x(1) = 0, \end{align}

using $t(1-t)$ and $t^2(1-t)$ as expansion function?

Thanks.

• Do you know the equations imposed by Galerkin's method? If so, please try to elaborate. – ccorn Jan 7 '15 at 12:17
• @ccorn Actually, I don't have enough information about that, I want to have a general solution with descriptions. – Qaher Jan 8 '15 at 8:22

Let $A \underline \alpha = b$. According to Galerkin's method we have
$$a_{ij} = \langle \varphi _{ni}, L \varphi_{ni} \rangle, \quad\quad b_i = \langle \varphi_{ni}, y \rangle$$ and ‎‎\begin{align*}‎‎ ‎\varphi_{21} & = t (1+t), & \varphi_{22} & = t^2(1-t), \\‎ L \varphi_{21} & = 2 + t^2 - t^3, & L \varphi_{23} & = 2- 6t + t^3 - t^4. ‎\end{align*}‎‎‎ then ‎‎\begin{align*}‎‎ ‎\langle‎\varphi_{21},L‎\varphi_{21}‎‎\rangle &‎ =‎ ‎\int_0^1 ‎t(1-t) ‎(-2+t^2 -‎ ‎t^3) ‎dt = ‎0.3967‎ ‎\\‎ ‎\langle‎‎\varphi_{21},L‎‎\varphi_{22}\rangle & = ‎‎‎‎\int_0^1 t(1-t)^2- 6t + t^3 - t^4) dt = 0.1571 \\‎ ‎\langle‎\varphi_{22},L‎‎\varphi_{22}\rangle & = ‎‎‎‎\int_0^1 t^2(1-t)(2-6t+t(t^2 - t^3)) dt =0.1274 \\ ‎\langle‎\varphi_{22},L‎‎\varphi_{21}‎‎\rangle & = ‎‎‎‎‎‎\int_0^1 (t^2-t^3)(-2+t^2 -t^3) dt = 0.1571 ‎\end{align*}‎‎‎ ‎\begin{align*}‎‎ ‎\langle‎‎\varphi_{21}, 1\rangle &‎ =‎ ‎\int_0^1 t‎ -‎ ‎t^2 ‎dt = ‎0.‎1667‎ ‎\\‎ ‎\langle‎‎\varphi_{22}, 1‎‎‎‎\rangle &‎ =‎ ‎\int_0^1 ‎t^2 -‎ ‎t^3 ‎dt =‎ ‎‎0.0833 ‎\end{align*}‎‎ finally $$\begin{bmatrix} 0.3967&0.1571\\‎ 0.1571&0.1274 \end{bmatrix}\begin{bmatrix} ‎\alpha_1\\‎ ‎\alpha_2‎ \end{bmatrix}=\begin{bmatrix} 0.1227\\‎ 0.0833 \end{bmatrix}‎‎$$ $$\Longrightarrow\alpha‎_1=‎0.520‎\qquad‎\text{‏and}‎‎‎‎\quad‎‎\alpha_2=0.‎012$$