# Restate the problem as first-order ODEs and use Euler's method to solve them

$x'' - tx' + x^2 = t$

$x(0) = 1$

$x'(0) = 1$

a) Restate the problem solving a system of first-order ODEs.

$x_1' = x_2$

$x_2' = t-x_1^2+tx_2$

$x_1(0) = 1$

$x_2(0) = 1$

b) Use part a) and Euler's method with h = 0.1 to find x(0.2).

$x(0.1) = 1 + (0.1)(0-1+0) = 0.9$

Is my work up to this point correct? I'm unsure whether this should actually be two equations.

-
Let $\hat{x}(t) = \begin{bmatrix} x_1(t) \\ x_2(t) \end{bmatrix}$. Write the first-order differential equation that $\hat{x}$ satisfies (you've basically done this already), and then use Euler's method to estimate $\hat{x}(.1)$ and $\hat{x}(.2)$. In other words, use Euler's method to estimate both $x_1$ and $x_2$. – littleO Nov 12 '12 at 7:56

Your part a) is correct, but for part b) remember that you've made $x_1=x$. Thus finding an approximate value for $x(0.2)$ is equivalent to finding an approximate value for $x_1(0.2)$, which you would find using the first of your two equations (looks like you've used the second one).

With the first equation, we use Euler's method to obtain the approximation $x_1(0.2)\approx x_1(0.1)+0.1\cdot x_2(0.1)$. We don't have $x_1(0.1)$ and $x_2(0.1)$ yet, we need to approximate them using Euler's method. Using the first equation, $x_1(0.1)\approx x_1(0)+0.1\cdot x_2(0)=1.1$. Using the second equation, $x_2(0.1)\approx x_2(0)+0.1\cdot (0-x_1(0)^2+0)=0.9$. Thus finally, $$x_1(0.2)\approx 1.1+0.1\cdot 0.9=1.19$$

-
The solutions says that the initial conditions are $x_1(0) = 0$ and $x_2(0) = 1$. Is this incorrect? – Bob John Nov 12 '12 at 7:38
That doesn't correspond to $x(0)=1$ and $x^\prime(0)=1$, which is what you have above. Since $x_1=x$, $x_1(0)$ should be 1 as well. $x_2=x_1^\prime=x^\prime$, so $x_2(0)=1$ is correct. – icurays1 Nov 12 '12 at 8:21
Fair enough. So the second equation isn't used for anything- the $x_2'$? – Bob John Nov 12 '12 at 8:51
You need to update both $x_1$ and $x_2$, and the $x_2'$ equation is used to update $x_2$. – littleO Nov 12 '12 at 9:26
So when it says find $x(0.2)$ I really need to find $x_1(0.2)$ and $x_2(0.2)$, correct? – Bob John Nov 12 '12 at 9:40

Let $\hat{x}(t) = \begin{bmatrix} x_1(t) \\ x_2(t) \end{bmatrix}$. Then $\hat{x}$ satisfies $$\hat{x}'(t) = f(t,\hat{x}(t))$$ for an appropriate function $f:\mathbb{R}^2 \to \mathbb{R}^2$. Now use Euler's method to estimate $\hat{x}(.1)$ and $\hat{x}(.2)$.

For example, $$\hat{x}(.1) \approx \hat{x}(0) + .1 f(0,\hat{x}(0)).$$

-