WEBVTT
00:00:00.790 --> 00:00:05.670
In this lesson, we’ll learn how to use Euler’s method to approximate solutions to differential equations.
00:00:06.540 --> 00:00:11.700
When we can’t solve a differential equation by analytical methods, we can use what are called numerical methods.
00:00:12.540 --> 00:00:18.780
From a given starting point, we use it to find repetitive process to approximate a solution to our differential equation.
00:00:19.640 --> 00:00:21.570
Euler’s method is one such process.
00:00:22.440 --> 00:00:26.330
We’ll begin by reminding ourselves of the meanings of some of the terms that we’ll use.
00:00:27.260 --> 00:00:32.400
We’ll then look at how Euler’s method is formulated and go on to see how it works with some examples.
00:00:33.250 --> 00:00:37.700
Remember that a differential equation is an equation containing one or more derivatives.
00:00:38.430 --> 00:00:43.020
The first-order differential equation contains only the first derivative d𝑦 by d𝑥.
00:00:43.650 --> 00:00:54.480
And for an unknown function 𝑦, we have the slope of 𝑦 in terms of the function 𝑓, which can be a function of 𝑥 and 𝑦, a function of 𝑥, or a function of 𝑦.
00:00:55.340 --> 00:01:04.830
And we might be asked to solve the differential equation d𝑦 by d𝑥 is equal to 𝑓 of 𝑥, 𝑦 given the initial value 𝑦 at 𝑥 is equal to zero is 𝑦 zero.
00:01:05.790 --> 00:01:08.820
This means that our starting point is the point 𝑥 zero, 𝑦 zero.
00:01:09.630 --> 00:01:12.340
And we’re to use this to find the function 𝑦 of 𝑥.
00:01:12.860 --> 00:01:23.080
When we do this numerically, we use the point 𝑥 zero, 𝑦 zero to find the value of 𝑦 one, which we then use to find 𝑦 two with our differential equation and so on to 𝑦 𝑛.
00:01:23.790 --> 00:01:26.840
This gives us our approximation to the function 𝑦 of 𝑥.
00:01:27.530 --> 00:01:32.960
Using Euler’s method, we do this by using a series of tangent lines to build up a picture of our solution.
00:01:33.700 --> 00:01:39.500
Since we’ll be using tangent lines, let’s keep our differential equation in mind but remind ourselves of some fact about straight lines.
00:01:40.260 --> 00:01:44.260
Suppose we have a straight line through the points 𝑥 zero, 𝑦 zero and 𝑥 one, 𝑦 one.
00:01:45.000 --> 00:01:50.140
The slope of this line 𝑚 is equal to 𝑦 one minus 𝑦 zero over 𝑥 one minus 𝑥 zero.
00:01:50.880 --> 00:01:55.640
Rearranging this we have 𝑦 one minus 𝑦 zero is equal to 𝑚 times 𝑥 one minus 𝑥 zero.
00:01:56.320 --> 00:02:00.520
This gives us 𝑦 one equal to 𝑦 zero plus 𝑚 times 𝑥 one minus 𝑥 zero.
00:02:01.300 --> 00:02:14.060
Now, if we go back to our differential equation, we know that the slope of 𝑦, d𝑦 by d𝑥, is equal to 𝑓 of 𝑥 𝑦 so that at the point 𝑥 zero, 𝑦 zero, the slope 𝑚 is equal to 𝑓 of 𝑥 zero, 𝑦 zero.
00:02:14.660 --> 00:02:24.650
And for our line through the points 𝑥 zero, 𝑦 zero and 𝑥 one, 𝑦 one, we have 𝑦 one equal to 𝑦 zero plus 𝑓 of 𝑥 zero, 𝑦 zero times 𝑥 one minus 𝑥 zero.
00:02:25.430 --> 00:02:33.470
And now, if we call the distance between 𝑥 zero and 𝑥 one ℎ, we have 𝑦 one equal to 𝑦 zero plus ℎ times 𝑓 of 𝑥 zero, 𝑦 zero.
00:02:34.510 --> 00:02:40.440
So we can calculate the value of 𝑦 one from knowing 𝑦 zero, ℎ, and 𝑓 of 𝑥 zero 𝑦 zero.
00:02:41.270 --> 00:02:43.910
Let’s see how this works on a graph of the function 𝑦.
00:02:44.800 --> 00:02:49.440
We have our starting point on the graph 𝑦 of 𝑥, which is 𝑥 zero, 𝑦 zero.
00:02:50.190 --> 00:02:53.020
We draw a tangent line to the curve at 𝑥 zero, 𝑦 zero.
00:02:53.760 --> 00:02:56.900
And we know that the slope of this line is 𝑓 of 𝑥 zero, 𝑦 zero.
00:02:57.870 --> 00:03:05.820
If we continue this line to where it meets the vertical with 𝑥 one, which is the distance ℎ from 𝑥 zero, this gives us the value 𝑦 one.
00:03:07.000 --> 00:03:14.200
Now, if we draw a tangent to the curve 𝑦 at the point 𝑥 one, 𝑦 one, this tangent has the slope 𝑓 of 𝑥 one, 𝑦 one.
00:03:14.880 --> 00:03:23.830
If this tangent then meets the vertical at 𝑥 two, which is the distance ℎ from 𝑥 one, we can find 𝑦 two, in terms of 𝑦 one, ℎ, and 𝑓 of 𝑥 one, 𝑦 one.
00:03:24.740 --> 00:03:37.730
If we continue in this way for a specified number of steps 𝑛 up to 𝑥 𝑛, on a specified step size ℎ we find 𝑦 𝑛 is equal to 𝑦 𝑛 minus one plus ℎ times 𝑓 of 𝑥 𝑛 minus one 𝑦 𝑛 minus one.
00:03:38.260 --> 00:03:43.090
And in this way, we find an approximation to 𝑦 of 𝑓 𝑥 which is a solution to the differential equation.
00:03:44.020 --> 00:03:48.410
It’s important to remember that we’re actually approximating a solution to the given differential equation.
00:03:48.670 --> 00:03:54.660
If our step size is quite large, our approximation might be quite far away from the actual solution function 𝑦 of 𝑥.
00:03:55.290 --> 00:03:58.970
We can increase the accuracy of our solution by decreasing the step size.
00:03:59.770 --> 00:04:01.890
Now, let’s see how this works with an example.
00:04:02.850 --> 00:04:09.330
Consider the initial value problem 𝑦 prime is four 𝑥 minus three 𝑦 where 𝑦 at 𝑥 equal to zero is negative one.
00:04:10.020 --> 00:04:16.330
Use Euler’s method with 𝑛 equal to five steps on the closed interval zero one to find the value of 𝑦 at 𝑥 is equal to one.
00:04:17.220 --> 00:04:26.390
We’ve actually been given a differential equation 𝑦 prime is equal to four 𝑥 minus three 𝑦 and an initial value 𝑦 at 𝑥 is equal to zero is negative one.
00:04:27.060 --> 00:04:32.550
This means that our starting point for Euler’s method is the point 𝑥 zero, 𝑦 zero which is equal to zero, negative one.
00:04:33.270 --> 00:04:40.390
We also know that we have five steps and that our closed interval zero, one means that zero is less than or equal to 𝑥 is less than or equal to one.
00:04:41.350 --> 00:04:45.320
So we have 𝑛 equal to five and zero less than or equal to 𝑥 less than or equal to one.
00:04:46.150 --> 00:04:49.960
We’re asked to use Euler’s method to find the value of 𝑦 at 𝑥 is equal to one.
00:04:50.820 --> 00:04:54.160
To do this, the first thing we need to do is to find the value of ℎ.
00:04:54.910 --> 00:04:56.170
That’s our step size.
00:04:57.020 --> 00:05:06.310
Now, ℎ is the interval width divided by the number of steps, in our case, the interval where there’s a maximum 𝑥 value one minus the minimum 𝑥 value zero which is one.
00:05:06.990 --> 00:05:08.250
The number of steps is five.
00:05:08.250 --> 00:05:10.320
So our step size is one over five.
00:05:10.860 --> 00:05:15.010
Let’s just sketch our Interval so that we can refer to it throughout our calculations.
00:05:15.780 --> 00:05:18.260
Our first 𝑥 value is zero, which is 𝑥 zero.
00:05:18.810 --> 00:05:21.560
Our step size is one over five, which is 0.2.
00:05:22.140 --> 00:05:24.310
So our next point 𝑥 one is 0.2.
00:05:24.980 --> 00:05:32.540
Our next 𝑥 value 𝑥 two is 0.4, 𝑥 three is 0.6, 𝑥 four is 0.8, and 𝑥 five is one.
00:05:33.440 --> 00:05:36.970
And remember, we’re being asked to calculate the value of 𝑦 at 𝑥 is equal to one.
00:05:37.840 --> 00:05:40.940
So that’s 𝑦 of 𝑥 five, which is 𝑦 five.
00:05:41.460 --> 00:05:44.340
So we’re going to use Euler’s method to calculate 𝑦 five.
00:05:45.020 --> 00:05:49.630
We can’t go directly to 𝑦 five because the only value we have is 𝑥 zero, 𝑦 zero.
00:05:50.550 --> 00:05:57.060
So we start at this point and calculate 𝑦 one, 𝑦 two, then 𝑦 three, then 𝑦 four, and then 𝑦 five.
00:05:58.150 --> 00:06:03.150
So to use the formula, we need to know the value of 𝑥 zero, 𝑦 zero, which is zero, negative one.
00:06:03.320 --> 00:06:08.390
We need to know ℎ, which is 0.2, and we need to know what the function 𝑓 of 𝑥, 𝑦 is.
00:06:09.140 --> 00:06:13.880
In our differential equation, 𝑦 prime, which is d𝑦 by d𝑥, is equal to four 𝑥 minus three 𝑦.
00:06:14.780 --> 00:06:18.130
So 𝑓 of 𝑥 𝑦, in our case, is four 𝑥 minus three 𝑦.
00:06:19.110 --> 00:06:21.700
We know that 𝑦 zero is equal to negative one.
00:06:22.360 --> 00:06:24.240
And we can use this to find 𝑦 one.
00:06:25.010 --> 00:06:33.730
And in the formula, if 𝑛 is equal to one, then 𝑛 minus one is equal to zero so that 𝑦 one is equal to 𝑦 zero plus ℎ times 𝑓 of 𝑥 zero, 𝑦 zero.
00:06:34.720 --> 00:06:38.560
We know that 𝑦 zero was negative one and that ℎ is 0.2.
00:06:39.910 --> 00:06:42.330
So we need to find 𝑓 of 𝑥 zero, 𝑦 zero.
00:06:43.230 --> 00:06:48.420
In our differential equation, 𝑓 of 𝑥 zero, 𝑦 zero is four 𝑥 zero minus three 𝑦 zero.
00:06:48.800 --> 00:06:59.550
And that’s equal to four times zero minus three times negative one, which is equal to three, so that 𝑦 one is equal to negative one plus 0.2 times three, which is negative 0.4.
00:07:00.260 --> 00:07:02.610
Now, we can use 𝑦 one to calculate 𝑦 two.
00:07:03.320 --> 00:07:05.770
We know that 𝑦 one is equal to negative 0.4.
00:07:05.770 --> 00:07:07.500
We know that ℎ is 0.2.
00:07:07.500 --> 00:07:09.620
So we need to work out 𝑓 of 𝑥 one, 𝑦 one.
00:07:10.300 --> 00:07:12.630
And that’s equal to four 𝑥 one minus three 𝑦 one.
00:07:13.330 --> 00:07:22.040
And since 𝑥 one is 0.2, that’s four times 0.2 minus three times negative 0.4, which is 0.8 plus 1.2 which is two.
00:07:22.470 --> 00:07:27.830
So 𝑦 two is equal to negative 0.4 plus 0.2 times two which is actually zero.
00:07:28.870 --> 00:07:34.800
Now, if we put 𝑛 equal to three in our formula, 𝑦 three is equal to 𝑦 two plus ℎ times 𝑓 of 𝑥 two 𝑦 two.
00:07:35.200 --> 00:07:38.190
We know that 𝑦 two is equal to zero and ℎ is 0.2.
00:07:38.190 --> 00:07:40.200
So we need to work out 𝑓 of 𝑥 two 𝑦 two.
00:07:40.720 --> 00:07:42.950
And that’s equal to four 𝑥 two minus three 𝑦 two.
00:07:43.820 --> 00:07:49.830
And since 𝑥 two is 0.4, that’s four times 0.4 minus three times zero, which is 1.6.
00:07:50.680 --> 00:07:56.310
So we have 𝑦 three equal to zero plus 0.2 times 1.6, which is 0.32.
00:07:57.660 --> 00:08:02.580
Now, with 𝑛 equal to four, we have 𝑦 four is equal to 𝑦 three plus ℎ times 𝑓 of 𝑥 three, 𝑦 three.
00:08:03.090 --> 00:08:05.940
𝑓 of 𝑥 three 𝑦 three is four 𝑥 three minus three 𝑦 three.
00:08:06.370 --> 00:08:19.340
So we have four times 0.6 minus three times 0.32 which is 1.44, so that 𝑦 four is equal to 0.32 plus 0.2 times 1.44 and that’s 0.608.
00:08:20.360 --> 00:08:26.250
And finally with 𝑛 equal to five in our formula, we have 𝑦 five equal to 𝑦 four plus ℎ times 𝑓 of 𝑥 four 𝑦 four.
00:08:26.910 --> 00:08:29.990
𝑓 of 𝑥 four 𝑦 four is equal to four 𝑥 four minus three 𝑦 four.
00:08:30.450 --> 00:08:42.630
And that’s equal to four times 0.8 minus three times 0.608 which is 1.376 so that we have 𝑦 five equal to 0.608 plus 0.2 times 1.376.
00:08:43.160 --> 00:08:45.630
And that’s equal to 0.8832.
00:08:46.300 --> 00:08:54.830
And remember that it’s exactly 𝑦 five that we’re looking for because this is the value of 𝑦 at 𝑥 is equal to one, so that 𝑦 of one is 0.8832.
00:08:57.560 --> 00:09:01.640
Now let’s plot our approximation to the function 𝑦, using the points that we found.
00:09:02.370 --> 00:09:11.050
The graph shown is a computer-generated solution of the differential equation 𝑦 prime is four 𝑥 minus three 𝑦 with initial value 𝑥 zero, 𝑦 zero is zero, negative one.
00:09:11.740 --> 00:09:16.060
And these are the points that we found using Euler’s method to find an approximation to the solution.
00:09:16.880 --> 00:09:21.710
If we plot our points on the graph, we can see it’s a very good approximation to the computer-generated solution.
00:09:22.610 --> 00:09:27.570
In our next example, we’ll look at a derivative or slope, which is a function of 𝑥 only.
00:09:28.650 --> 00:09:33.290
And then we’ll compare different solutions, which have used different step sizes for the approximations.
00:09:34.130 --> 00:09:39.780
Consider the initial value problem 𝑦 prime is three 𝑥, where 𝑦 at 𝑥 is equal to zero is equal to one.
00:09:40.650 --> 00:09:46.170
Use Euler’s method with 𝑛 equal to five steps on the closed interval zero, one to find 𝑦 at 𝑥 is equal to one.
00:09:46.840 --> 00:09:53.580
We’ve been given a differential equation 𝑦 prime is three 𝑥 so that 𝑦 prime, which is d𝑦 by d𝑥, is equal to three 𝑥.
00:09:54.000 --> 00:10:01.100
We have an initial value 𝑦 at 𝑥 is equal to zero is equal to one, which means that our starting point 𝑥 zero, 𝑦 zero is zero one.
00:10:01.890 --> 00:10:06.060
We have 𝑛 equals to five steps and the closed interval zero, one.
00:10:06.720 --> 00:10:09.870
This means that zero is less than or equal to 𝑥 is less than or equal to one.
00:10:10.390 --> 00:10:14.180
And we’re asked to use Euler’s method to find the value of 𝑦 at 𝑥 is equal to one.
00:10:14.590 --> 00:10:18.740
In order to use this formula, we need to know the value of ℎ, which is the step size.
00:10:19.340 --> 00:10:22.420
And that’s given by the interval width divided by the number of steps.
00:10:22.710 --> 00:10:29.330
In our case, the interval width is a maximum 𝑥 minus the minimum 𝑥 which is one minus zero divided by the number of steps which is five.
00:10:29.870 --> 00:10:31.840
That’s one over five, which is 0.2.
00:10:32.570 --> 00:10:36.260
Let’s just sketch our interval, so we can refer back to it in our calculations.
00:10:36.910 --> 00:10:42.880
Since our step size is 0.2 and 𝑥 zero is equal to zero, 𝑥 one is equal to 0.2.
00:10:43.530 --> 00:10:52.070
Similarly, 𝑥 two is equal to 0.4, 𝑥 three is 0.6, and 𝑥 four is 0.8, and 𝑥 five, which is our maximum value is one.
00:10:52.810 --> 00:10:55.720
Remember, we’re trying to find the value of 𝑦 when 𝑥 is equal to one.
00:10:55.980 --> 00:10:57.610
And that’s 𝑦 of 𝑥 five.
00:10:58.250 --> 00:10:59.700
And we call that 𝑦 five.
00:11:00.600 --> 00:11:03.800
In order to use the formula, we need to know what our function 𝑓 is.
00:11:04.480 --> 00:11:10.250
And from our differential equation, we can see that d𝑦 by d𝑥 is equal to 𝑓 of 𝑥 is three 𝑥.
00:11:10.250 --> 00:11:26.530
So if this is a function of 𝑥 only, this means we can delete the second variable 𝑦 in our function 𝑓 in Euler’s formula, so that our formula is 𝑦 𝑛 is equal to 𝑦 𝑛 minus one plus ℎ times 𝑓 of 𝑥 𝑛 minus one, where 𝑓 of 𝑥 𝑛 is three 𝑥 𝑛.
00:11:27.470 --> 00:11:29.600
So we have everything we need to use the formula.
00:11:30.110 --> 00:11:34.920
We know that 𝑦 zero is equal to one, so we can use the formula to calculate 𝑦 one.
00:11:35.230 --> 00:11:38.030
And that’s equal to 𝑦 zero plus ℎ times 𝑓 of 𝑥 zero.
00:11:38.670 --> 00:11:43.030
We know the value of 𝑦 zero, which is one, and we know the value of ℎ, which is 0.2.
00:11:43.110 --> 00:11:44.970
So we need to work out 𝑓 of 𝑥 zero.
00:11:45.750 --> 00:11:55.480
From our differential equation, that’s equal to three times 𝑥 zero, which is three times zero, which is zero so that 𝑦 one is equal to one plus 0.2 times zero, which is one.
00:11:56.170 --> 00:12:01.350
And we can use this in our formula to calculate 𝑦 two, which is equal to 𝑦 one plus ℎ times 𝑓 of 𝑥 one.
00:12:01.780 --> 00:12:03.560
And we need to work out 𝑓 of 𝑥 one.
00:12:03.950 --> 00:12:07.250
That’s equal to three times 𝑥 one from our differential equation.
00:12:07.770 --> 00:12:10.660
And from our interval, we know that 𝑥 one is equal to 0.2.
00:12:10.720 --> 00:12:15.630
So we have three times 0.2 is equal to 𝑓 of 𝑥 one, and that’s 0.6.
00:12:16.190 --> 00:12:21.490
So 𝑦 two is equal to one plus 0.2 times 0.6 which is equal to 1.12.
00:12:22.940 --> 00:12:33.970
We use this to find 𝑦 three, which is 𝑦 two plus ℎ times 𝑓 of 𝑥 two, where 𝑓 of 𝑥 two is three times 𝑥 two and 𝑥 two is 0.4, so that 𝑓 of 𝑥 two is 1.2.
00:12:34.500 --> 00:12:40.000
𝑦 three is then 1.12 plus 0.2 times 1.2, which is 1.36.
00:12:41.340 --> 00:12:47.920
We use this to calculate 𝑦 four which is 𝑦 three plus ℎ times 𝑓 of 𝑥 three and 𝑓 of 𝑥 three is three times 𝑥 three.
00:12:48.490 --> 00:12:51.070
From our interval, 𝑥 three is 0.6.
00:12:51.070 --> 00:12:54.260
So that’s three times 0.6, which is 1.8.
00:12:55.060 --> 00:13:00.850
And we have 𝑦 four equal to 1.36 plus 0.2 times 1.8, which is 1.72.
00:13:01.970 --> 00:13:10.360
Now, we use this in our final step to calculate 𝑦 five, where 𝑦 five is equal to 𝑦 four plus ℎ times 𝑓 of 𝑥 four which is three 𝑥 four.
00:13:11.010 --> 00:13:17.130
And since 𝑥 four is 0.8 from our interval, 𝑓 of 𝑥 four is three times 0.8, which is 2.4.
00:13:17.510 --> 00:13:22.630
So 𝑦 five is equal to 1.72 plus 0.2 times 2.4, which is 2.2.
00:13:23.510 --> 00:13:28.960
Remember that 𝑦 five is equal to 𝑦 at 𝑥 is equal to one, which we’ve just calculated as 2.2.
00:13:29.060 --> 00:13:31.630
So 𝑦 at 𝑥 is equal to one is 2.2.
00:13:34.680 --> 00:13:38.720
In our example, we were given 𝑛 equal to five steps on the closed interval zero, one.
00:13:39.220 --> 00:13:41.720
This resulted in the step size of 0.2.
00:13:42.530 --> 00:13:50.830
From an initial value of 𝑥 zero, 𝑦 zero, which is equal to zero one, we calculated all the steps up to 𝑥 five, 𝑦 five and arrived at one, 2.2.
00:13:51.760 --> 00:14:00.660
The graph shown gives a computer-generated solution to the differential equation and our approximated solution with the five points that we calculated.
00:14:01.110 --> 00:14:03.780
Now, let’s see what happens if we decrease the step size.
00:14:04.420 --> 00:14:09.530
With 𝑛 equal to 10 in the step size of 0.1 now, we have five extra points.
00:14:10.120 --> 00:14:15.610
On our graph, we can see that the approximation with the smaller step size is closer to the computer-generated solution.
00:14:16.550 --> 00:14:24.820
So when the step size is smaller, the approximate solution is closer to the actual solution, although notice that we needed to do more iterations in our calculation.
00:14:25.880 --> 00:14:28.660
Let’s summarize now what we’ve covered in Euler’s method.
00:14:29.690 --> 00:14:44.600
We’ve been looking at Euler’s method for first-order differential equations, which is a numerical method for solving first-order differential equations of the form d𝑦 by d𝑥 is 𝑓 of 𝑥, 𝑦 or d𝑦 by d𝑥 is 𝑓 of 𝑥 or d𝑦 by d𝑥 is 𝑓 of 𝑦.
00:14:45.320 --> 00:14:50.110
In order to solve, we’re given an initial value, which is 𝑦 at 𝑥 equal to 𝑥 zero.
00:14:50.290 --> 00:14:59.090
And that’s equal to 𝑦 zero, so that from our starting point 𝑥 zero, 𝑦 zero, we have 𝑛 steps in the interval 𝑥 zero to 𝑥 𝑛.
00:14:59.690 --> 00:15:12.190
We use the formula 𝑦 𝑛 is equal to 𝑦 𝑛 minus one plus ℎ times 𝑓 of 𝑥 𝑛 minus one 𝑦 𝑛 minus one to find successive values of 𝑦, in order to form an approximation to the solution 𝑦 of 𝑥.
00:15:13.290 --> 00:15:17.330
ℎ is the step size, which is the interval width divided by the number of steps.
00:15:17.800 --> 00:15:21.920
And we know that the smaller the step size ℎ, the more accurate the approximation.
00:15:22.080 --> 00:15:24.350
But this means more iterations will be necessary.