One of the aims of MAM1000W isn’t just to teach you individual mathematical topics, but over time to allow you to see the links between these subjects. Sometimes we do this explicitly, and sometimes you should notice the connections yourself simply by seeing one topic pop up in the middle of another. As I’ve written before, so much of it is about noticing patterns.

Today in class I gave a differential equation which wouldn’t be solvable by any of the methods we have looked at. $y''(x)+\cos(x)y'(x)+e^xy(x)=x^2$

This is second order linear but its coefficients are not constant. We don’t have any way in to solve this. We actually wanted to solve this with the initial conditions $y(0)=1$ and $y'(0)=-1$.

Actually, that’s a lie. We didn’t want to solve it, but we wanted to get an approximation for the solution close to $x=0$. This is like saying: OK, so we have a differential equation for population dynamics, or climate change, or the heating of an object, and we don’t worry too much about the very far future, but we want to know what it’s going to do in the short term. So what we really want is to find a function $y(x)$ which is a good approximation for the solution close to $x=0$.

We know a really good way of approximating functions, and that’s by a polynomial expression. So let’s say that we want our solution to be of the form: $y(x)_{approx}=a_0+a_1 x+a_2 x^2+a_3 x^3+a_4 x^4$

We aren’t always guaranteed that we can do this, but we would be able to see pretty quickly if it’s not going to work. We’ve got a load of unknown constants $a_i$ and we are going to want to fix these such that $y_{approx}$ approximately solves the differential equation and has the initial conditions that we are imposing.

We can actually start off with the initial conditions. If we want our $y_{approx}$ to satisfy $y(0)=1$ and $y'(0)=-1$, then we have: $y_{approx}(0)=1=a_0+a_1 0+a_2 0+...$

and then we take the derivative of $y_{approx}$ to get: $y'(x)_{approx}=a_1+2 a_2 x+3 a_3 x^2+4a_4 x^3$ and so $-1=a_1$ which leaves us with: $y(x)_{approx}=1- x+a_2 x^2+a_3 x^3+a_4 x^4$

ok, now let’s plug this into the differential equation and see what we get. Taking first and second derivatives we get: $(2 a_2+6 a_3 x+12 a_4 x^2)+\cos(x)(-1+2 a_2 x+3 a_3 x^2+4a_4 x^3)+e^x(1- x+a_2 x^2+a_3 x^3+a_4 x^4)=x^2$

So that looks like we’ve just taken something complicated and made it worse…however, we remember that $\cos(x)$ and $e^x$ can be written also as polynomial approximations. Let’s expand each of them up to second order and see what we get. We could go further, but we won’t need to: $(2 a_2+6 a_3 x+12 a_4 x^2)+(1-\frac{x^2}{2})(-1+2 a_2 x+3 a_3 x^2+4a_4 x^3)+(1+x+\frac{x^2}{2})(1- x+a_2 x^2+a_3 x^3+a_4 x^4)=x^2$

Now it looks even worse than before…but wait…let’s try and rearrange things a bit. Let’s take each of these terms, expand out the brackets and only keep terms up to $x^2$. Remember that because we are trying to find the solution to this close to $x=0$, the higher order terms get smaller and smaller. Expand to maximum $x^2$ we have: $(2 a_2+6 a_3 x+12 a_4 x^2)+\left(2 a_2 x+\left(3 a_3+\frac{1}{2}\right) x^2-1\right)+\left(\left(a_2-\frac{1}{2}\right) x^2+1\right)=x^2$

ok, still a mess. Now let’s organise this so that we collect order by order in $x$: $2a_2+x (2 a_2+6 a_3)+x^2(a_2+3 a_3+12 a_4-1)=0$

That’s much better. OK, so we want this to hold for any small $x$. So each term needs to vanish on its own. This means that we must have: $a_2=0$

$latex (2 a_2+6 a_3)=0$

$latex (a_2+3 a_3+12 a_4-1)=0$

In fact, solving each of these in turn we find that $a_2=0$, $a_3=0$ but $a_4=\frac{1}{12}$. Thus, an approximation for a solution of the differential equation which satisfies the initial conditions is: $y_{approx}=1-x+\frac{x^4}{12}$.

We can see that we could go to higher and higher order if we wanted to get a more accurate solution. In fact, if we go up to 10th order then we end up with: $y_{approx}=1-x+\frac{x^4}{12}+\frac{x^6}{360}+\frac{x^7}{420}-\frac{x^8}{1008}-\frac{13 x^9}{60480}+\frac{17 x^{10}}{362880}$.

With this approximation, if we compare it with a very accurate numerical solution, we find that it matches very well up to around $x=2$. With 20 terms we can get an accurate solution out to $x=2.5$.

This shows that for this example, if you wanted to go to large values of $x$, this isn’t a very good way to go, but we can at least get a good approximation for the solution close for small $x$. To find the solution for all $x$ we need to develop some interesting numerical methods which you might discover later on in your mathematics courses.

 How clear is this post?