Why Time Is One of the Inputs
In some differential equations, the rate of change depends on the solution alone. In others, the rate also changes directly with time. For example, \(y'=t+y\) has slope function \(f(t,y)=t+y\): even if the solution value \(y\) stays fixed, changing \(t\) changes the slope.
Forward Euler handles this by using the slope at the current time and the current approximate solution. The two inputs must be kept together. Using the right solution value with the wrong time can produce a different step, even when the arithmetic is otherwise correct.
The Update Rule for a Time-Dependent Slope
Consider an initial-value problem \(y'=f(t,y)\), \(y(t_0)=y_0\). On a uniform grid with step size \(h>0\), define \(t_n=t_0+nh\). Forward Euler generates approximations by
Here \(t_n\) is the current time, \(y_n\) is the current approximation to the solution, and \(f(t_n,y_n)\) is the slope used for that step. The next time is \(t_{n+1}=t_n+h\). The time advances by \(h\), while the solution value advances by \(h\) times the current slope.
The word “explicitly” matters. In \(f(t,y)=t+y\), changing the time argument while holding \(y\) fixed changes the output. By contrast, when the right-hand side has no explicit time input, it can be written \(y'=f(y)\), and the Euler slope depends on the current solution value alone. In either case, the update uses the slope at the current step.
Why the Current Pair Determines the Slope
The differential equation states that the derivative at time \(t\) is determined by the time and solution value at that time: \(y'(t)=f(t,y(t))\). In particular, at the current grid time \(t_n\), the solution’s slope is \(f(t_n,y(t_n))\). A numerical method does not generally know the exact value \(y(t_n)\), so Forward Euler uses its current approximation \(y_n\) in its place.
This gives the rule its input order: first evaluate the slope at the known current pair; then multiply that slope by the step size; finally add the result to the current solution value. The new time \(t_{n+1}\) labels the updated approximation, but it is not the time at which this step’s slope is evaluated.
This justification explains which slope Euler uses; it does not say that \(y_n\) is the exact solution value or that the method has zero error. The Euler values are approximations generated by the recurrence.
Worked Steps with Both Inputs
Worked Example: Two Steps for \(y'=t+y\)
Use Forward Euler with \(h=0.5\) for \(y'=t+y\), starting from \(t_0=0\) and \(y_0=1\). The slope function is \(f(t,y)=t+y\). We evaluate it at the current time and current solution value at each step.
At the first step, \(t_0=0\) and \(y_0=1\), so
The Euler update gives
For the second step, use the new current pair \((t_1,y_1)=(0.5,1.5)\):
Thus
Check the updates: \(1+0.5(1)=1.5\), and \(1.5+0.5(2)=2.5\). The slopes \(1\) and \(2\) come from evaluating \(t+y\) at the current pairs \((0,1)\) and \((0.5,1.5)\), respectively.
Worked Example: A Slope That Changes Sign with Time and State
Apply Forward Euler to \(y'=2t-y\), with \(t_0=1\), \(y_0=2\), and \(h=0.25\). Here \(f(t,y)=2t-y\). Find three updates.
At step \(0\), evaluate at \((1,2)\):
At step \(1\), the solution approximation is still \(2\), but the time has changed. Evaluate at \((1.25,2)\):
so
At step \(2\), use \((1.5,2.125)\):
and therefore
Check each value against the update: \(2+0.25(0)=2\), \(2+0.25(0.5)=2.125\), and \(2.125+0.25(0.875)=2.34375\). The first slope is zero, but the next is not: the explicit time input changed while the solution approximation remained \(2\).
Worked Example: A Zero First Slope Does Not End the Calculation
Use Forward Euler with \(h=0.5\) for \(y'=t(2-y)\), starting from \(t_0=0\), \(y_0=0\). The slope function is \(f(t,y)=t(2-y)\). Find three updates.
At the initial pair, the time factor makes the slope zero:
The method still proceeds to the next step. At \((t_1,y_1)=(0.5,0)\),
At \((t_2,y_2)=(1,0.5)\),
Check the updates: \(0+0.5(0)=0\), \(0+0.5(1)=0.5\), and \(0.5+0.5(1.5)=1.25\). The zero initial slope means the first Euler update leaves the solution value unchanged; it does not imply that later slopes are zero.
A Common Mistake: Using the New Time Too Soon
A frequent error is to evaluate the current step’s slope at the next time. For example, in the first step of \(y'=t+y\) from \((t_0,y_0)=(0,1)\) with \(h=0.5\), the correct slope is
The correct next approximation is \(y_1=1+0.5(1)=1.5\). If the new time is used prematurely, one might instead calculate
That is not the Forward Euler update: it uses \((t_1,y_0)\), a pair consisting of the next time and the old solution approximation. The correction is to evaluate \(f\) at \((t_0,y_0)\), then update the solution and time together. Another error is to drop the time input and treat \(f(t,y)=t+y\) as though it were only \(f(y)=y\); that would give the wrong slope even at the initial pair.
A Reliable Calculation Routine
When completing a table or computing several steps, keep a separate record of time, solution approximation, slope, and next solution value. The following sequence prevents the two inputs from becoming separated:
Write down \(t_n\) and \(y_n\), not the next time and the current solution mixed together.
Substitute both current values into \(f(t,y)\) to obtain \(f(t_n,y_n)\).
Calculate \(y_{n+1}=y_n+h f(t_n,y_n)\), retaining the current value as the starting value for the step.
Set \(t_{n+1}=t_n+h\), then use the new pair for the next slope evaluation.
This bookkeeping is especially useful when the slope changes with time independently of the solution. A repeated solution value does not mean the next slope must repeat, and a zero slope at one time does not imply a zero slope at every later time.
Check Your Understanding
For each question, make sure you identify both inputs to the slope function.
- For \(y'=3t-y\), what expression gives the Forward Euler slope at step \(n\)?
- If \(y'=t+y\), \(t_n=2\), and \(y_n=1\), what is the slope used for the next update?
- With the data in Question 2 and \(h=0.1\), calculate \(y_{n+1}\) and \(t_{n+1}\).
- Why is evaluating \(f(t_{n+1},y_n)\) generally not the Forward Euler slope for step \(n\)?
- For \(y'=t(2-y)\), \(t_n=0\), and \(y_n=0\), the current slope is zero. Does that alone show that the next slope is zero? Explain.