TITLE: How can I solve this Initial Value Problem using the Euler method?
QUESTION [5 upvotes]: My Problem is this given Initial Value Problem: $$y^{\prime}=\frac{3x-2y}{x}\quad y(1)=0$$ I am looking for a way to solve this problem using the Euler method. I have a given Interval of $[1,2]$ and a given step size $h$ of $h=0.1$
My Approach was: I can see, this is a differential Equation of first-order. I have one given initial condition $y(1)=0$. So this must be a initial value problem of first order.
For the Euler Method, we need a step size of $h>0$. So our $0.1$ seems to be okay. Next thing, should be calculating: $$t_k=t_0+kh, \quad \quad k=0,1,2,\dots $$
And this is the point where i think i am stuck. I failed in calculating this and after reading the definitions i didn't succeed in making the connection from this method towards a solution for my given initial value problem, at all.

REPLY [2 votes]: We are given:
$$y'=\dfrac{3x-2y}{x}\quad y(1)=0$$ 
Interval is $x \in[1,2]$, and a given step size $h=0.1$
We have:

$h = \dfrac{b-a}{N} = .1 = \dfrac{2-1}{N} \rightarrow N = 10$
$x = a = 1$
$y(a) = y(1) = \alpha = 0 \rightarrow a = 1, \alpha = 0$

Set:

$x_0 = 1, x_i = 1 + 0.1 i, y_0 = 0$
Using Euler's, we have: $y_i = y_{i-1} + hf(x, y) = y_{i-1} + .1\left(\dfrac{3 x_{i-1} - 2 y_{i-1}}{x_{i-1}}\right)$

For $i= 1$, we have:
$x_0 = 1, y_0 = 0, y_1 = y_{0} + .1\left(\dfrac{3 x_{0} - 2 y_{0}}{x_{0}}\right) = 0 + .1 \dfrac{3 (1) - 2(0)}{1.1} = 0.3$
For $i= 2$, we have:
$x_1 = 1.1, y_1 = 0.3, y_2 = y_{1} + .1\left(\dfrac{3 x_{1} - 2 y_{1}}{x_{1}}\right) = 0.3 + .1 \dfrac{3 (1.1) - 2(.3)}{1.1} = 0.5454$
Continuing this way, we generate the table:
$~~~~~\text{Step} ~~|~~ x ~~~|~~ y $

$~~00 ~~| 1.0~~ | 0. $
$~~01 ~~| 1.1 ~~| 0.3 $
$~~02 ~~| 1.2 ~~| 0.545455 $
$~~03 ~~| 1.3 ~~| 0.754545 $
$~~04 ~~| 1.4 ~~| 0.938462 $
$~~05 ~~| 1.5 ~~| 1.1044 $
$~~06 ~~| 1.6 ~~| 1.25714 $
$~~07 ~~| 1.7~~ | 1.4 $
$~~08 ~~| 1.8~~ | 1.53529 $
$~~09 ~~| 1.9 ~~| 1.66471$ 
$~~10~~| 2.0~~ | 1.78947 $

The exact solution is given by:
$$y(x) =  \dfrac{x^3-1}{x^2}$$
At $x=2$, we have: $y(2) = \dfrac{7}{4} = 1.75$
Compare that to Euler's method, which has $1.78947$.