Finding local maximum of solution of a differential equation

The problem is this:

Given the differential equation $$y' + \frac{1}{2}y = 2\cos t, y(0)=-1$$ Find the coordinates of the first local maximum for the solution when $t>0$

I'm not sure, how to proceed here. I have found the solution given the initial condition which is

$$y(t) = \frac{1}{5}(-9e^{-t/2} + 8 \sin t + 4 \cos t)$$

and from my calculus courses I remember that you have to set $y'(t)=0$ to find the critical points, so I did and got

$$y'(t)=0 \Rightarrow \frac{9}{2}e^{-t/2} + 8 \cos t - 4 \sin t = 0$$

This seems to suggest an infinite number of local maxima and minima for $t>0$, which I corroborated by looking at a graph of the function.

Using wolfram I found that the first local maximum is at $t\approx 1.36431,$ but I haven't had a course on numerical apporximation, so my question is:

Is there an analytic method for finding this local maximum?

I appreciate any help!

Note: There is an identical question here:Given: $y'+\frac{1}{2}y =2\cos t, \ y(0) = -1$ to find the coordinates of the first local maximum point $t>0$ but it never got answered so I hope this one doesn't get closed. Thanks!

• It seems like you haven't plotted your solution to the ODE when looking at the title of the graph. In any case, I think calculating the roots analytically might be a hopeless task. – garserdt216 Mar 1 '17 at 3:43
• I went easy on the might; it most certainly is futile. Since you have a graph, you could use Newton's method provided you feed in a good initial guess near the root you want to compute. – garserdt216 Mar 1 '17 at 3:46
• @garserdt216 thanks! I guess I'll have to start iterating then... – Luis Vera Mar 1 '17 at 3:52

As you suspect, using numerical methods will solve the problem easily but we shall not use any of them and we shall try to approximate the solution of the transcendental equation which, by definition, cannot show any analytical expression.

Considering the first derivative $$y'(t)= \frac{9}{2}e^{-t/2} + 8 \cos(t) - 4 \sin( t)$$ and using your observation from the plot, let us consider Taylor series built around $t=a$. They are $$e^x=e^{-a}-e^{-a} (x-a)+\frac{1}{2} e^{-a} (x-a)^2+O\left((x-a)^3\right)$$ $$\sin (x)=\sin (a)+(x-a) \cos (a)-\frac{1}{2} (x-a)^2 \sin (a)+O\left((x-a)^3\right)$$ $$\cos(x)=\cos (a)-(x-a) \sin (a)-\frac{1}{2} (x-a)^2 \cos (a)+O\left((x-a)^3\right)$$ Applying them (using for simplicity $a=\frac \pi 2$), we then have $$y'(t)=\left(\frac{9 e^{-\pi /4}}{10}-\frac{4}{5}\right)-\left(\frac{8}{5}+\frac{9 e^{-\pi /4}}{20}\right) \left(t-\frac{\pi }{2}\right)+\left(\frac{2}{5}+\frac{9 e^{-\pi /4}}{80}\right) \left(t-\frac{\pi }{2}\right)^2+O\left(\left(t-\frac{\pi }{2}\right)^3\right)$$ which then reduces to a quadratic equation in $\left(t-\frac{\pi }{2}\right)$.

Using the classical formula, we then arrive to $$y'(t)=0 \implies t=\frac{\pi }{2}+\frac{2 \left(9+32 e^{\pi /4}-\sqrt{3 \left(-27+48 e^{\pi /4}+512 e^{\pi /2}\right)}\right)}{9+32 e^{\pi /4}}\approx 1.36548$$ while the exact solution would be $t\approx 1.36431$ which seems to be quite good.

Using the result of the approximation, the maximum would be $\approx 0.820081$ while the exact solution would be $\approx 0.820082$.

Edit

We could have done better using $a=\frac{5 \pi }{12}$ (we know the values of the trigonometric functions for this angle). Doing the same as above, we should have

$$y'(t)=\left(-3 \sqrt{2}+\sqrt{6}+\frac{9}{2} e^{-5 \pi /24}\right)-\left(\sqrt{2}+3 \sqrt{6}+\frac{9}{4} e^{-5 \pi /24}\right) \left(t-\frac{5 \pi }{12}\right)+\left(\sqrt{6-3 \sqrt{3}}+\frac{9}{16} e^{-5 \pi /24}\right) \left(t-\frac{5 \pi }{12}\right)^2+O\left(\left(t-\frac{5 \pi }{12}\right)^3\right)$$ Ignoring the quadratic term, the zero would be given as $t\approx 1.36392$. Using the quadratic term, $t\approx 1.36429$.

• Very nice! Thank you for your answer, I didn't even think to use the Taylor series – Luis Vera Mar 1 '17 at 17:57
• @LuisVera. YOu arre welcome ! May I confess that my passion for Taylor series started 60 years ago and that it is more and more intense. Being serious : approximation of functions (Taylor, Padé,..) is a big key for most problems. Just think about it : what is Newton method ? What is Halley's ? What is Householder's ? Cheers. – Claude Leibovici Mar 1 '17 at 19:26

My first answer was using Taylor series to approximate locally the function $y'(t)$.

We could also use Padé approximants which are ratios of polynomials of different degrees of the form $$f(x)=\frac{\sum_{i=0}^m a_i (x-x_0)^i}{1+\sum_{i=1}^n b_i (x-x_0)^i}$$ the coefficients being defined from the successive derivatives of the function evaluated at point $x=x_0$.

To simplify the calculations here, we shall use $x_0=0$ (which extremely simplify the value of the different terms), $m=1$ (to just solve a linear equation) and vary $n$; this will make the solution to be $t=-\frac{a_0}{a_1}$.

The table below reproduces for $y'(t)=0$ the exact results and their decimal representation as well as the value of $y(t)$ as a function of $n$. $$\left( \begin{array}{ccc} n & t_n & & y(t_n)\\ 0 & 2 & 2.00000 & 0.459775 \\ 1 & \frac{20}{21} & 0.95238 & 0.649412 \\ 2 & \frac{126}{85} & 1.48235 & 0.806614 \\ 3 & \frac{200}{153} & 1.30719 & 0.816871 \\ 4 & \frac{5202}{3797} & 1.37003 & 0.820050 \\ 5 & \frac{75940}{55651} & 1.36458 & 0.820082 \\ 6 & \frac{333906}{245327} & 1.36107 & 0.820072 \\ 7 & \frac{137383120}{100565709} & 1.36610 & 0.820079 \\ 8 & \frac{1810182762}{1327776461} & 1.36332 & 0.820081 \\ 9 & \frac{26555529220}{19459260621} & 1.36467 & 0.820082 \\ 10 & \frac{428103733662}{313814366413} & 1.36419 & 0.820082 \end{array} \right)$$