# find minimum of given function

today my relative asked a problem,which had strange solution and i am curious, how this solution is get from such kind of equations. let say function has form

$f(x)=a\sin(x)+b\cos(x)$

we should find it's minimum,we have not any constraints or something like this,as i know to find minimum,we should find point where it reaches minimum and then put this point into first equation,so in our case we have

$f'(x)=a\cos(x)-b\sin(x)$ or when we set this to zero and also convert in tangent form ,we get

$\tan(x)=a/b\\;\text{or}\;x=tan^{-1} (a/b)$

now if we put this into first equation,it would be difficult without calculator to calculate minimum,let say $a=3$ and $b=2$, but my relative told me there exist such kind of formula that minimum is directly $\sqrt{a^2+b^2}$, in our case $\sqrt{13}$, is it right? first of all i think that we can get value $3$, if $\alpha=0$;

• Pedantic note: taking as usual the non-negative square root, $\sqrt{a^2+b^2}$ is the maximum, the minimum is $-\sqrt{a^2+b^2}$ then. – Daniel Fischer Jul 5 '13 at 21:09

It appears that the main confusion here is how to find $$\sin(\tan^{-1}(a/b))\quad \text{or}\quad \cos(\tan^{-1}(a/b))$$

Well, we have $\tan(\theta) = \frac{a}{b}$, for some $\theta$. So, let's create a right triangle like that, where the opposite side has length $a$, and the adjacent side has length $b$. We know that $\sin(\theta) = \frac{\text{opp}}{\text{hyp}}$, so then: $$\sin(\theta) = \frac{a}{\sqrt{a^2 + b^2}}$$

We also know that $\tan^{-1}(a/b)=\theta$, so then: $$\sin(\tan^{-1}(a/b)) = \frac{a}{\sqrt{a^2+b^2}}$$

The procedure for cosine is similar.

• @dato hahaha... I sometimes wish I could accept multiple answers as well. Unfortunately, you can only accept one. Just pick the one that you thought was the most helpful to you, and then don't worry about it. ;) We won't take it personally if you accept someone else's answer. :) – apnorton Jul 5 '13 at 21:21
• :D yes i am joking,i know,you all are great – dato datuashvili Jul 5 '13 at 21:22

Let's take $\phi$ such that $\cos \phi=\frac{a}{\sqrt{a^2+b^2}}$, $\sin \phi=\frac{b}{\sqrt{a^2+b^2}}$, then our function writes

$$\sqrt{a^2+b^2}\sin x \cos\phi+\sqrt{a^2+b^2}\sin\phi\cos x=\sqrt{a^2+b^2}\sin(x+\phi).$$ Now it's easy to minimize it.

• so it means that $\sqrt{a^2+b^2}*cos(x+\phi)=0$ – dato datuashvili Jul 5 '13 at 21:12
• @dato if you want to find critical points by using derivatives, then yes. You can find those points by looking directly at the behaviour of the $\sin$ function. – TZakrevskiy Jul 5 '13 at 21:15

Once you have $x_0 = \tan^{-1}(a/b)$ we can throw that back into $\sin(x)$ and $\cos(x)$ without trouble.

Notice that if $x_0$ was the angle value that gave you $a/b$ after applying tangent, then we can think of $x_0$ as an angle of a right triangle with opposite side '$a$' and adjacent side '$b$'. This would give us the hypotenuse $\sqrt{a^2 + b^2}$.

Thus applying this function to our particular $x_0$ we find that $$f(x_0) = a \cdot \frac{a}{\sqrt{a^2+b^2}} + b \cdot \frac{b}{\sqrt{a^2+b^2}}$$ which after a quick calculation we find $$f(x_0) = \sqrt{a^2+b^2}.$$

• aaaa i understood.thanks a lot of – dato datuashvili Jul 5 '13 at 21:14

If you want to know how to derive that formula, here it is: We have $f(x)=a \sin x +b \cos x$ . Hmm, this looks strangely familiar to the identity $r\sin (x+t)= r(\sin x \cos t + \sin t \cos x)$ , and if our function was of the form $f(x)=r\sin (x+t)$ then the maximum would be easy to find. It would be $r$ which is the amplitude, right? So let's see if we can get our function into a form of $r\sin (x+t)$ . We multiply our $f(x)$ by a number $r$, so we have $rf(x)=ra \sin x +rb \cos x$ . Because we want to have $r f(x) =\sin x \cos t +\cos x \sin t$ . We want $ra=\cos t$ and $rb=\sin t$ . We know that $\sin^2 t +\cos^2 t =1$ , so $r^2 a^2+r^2 b^2=1$ $\to$ $r= \large \frac {1}{a^2+b^2}$ . Therefore we have $\large \frac {1}{a^2+b^2} f(x)= \sin (x+t)$ $\to$ $f(x)=(a^2+b^2) \sin(x+t)$ . So the maximum of $f(x)$ $\,$ is $a^2+b^2$ . However, there is one more thing I didn't explain; the motivation behind multiplying everything by the constant $r$ . This is because your example was $3 \sin x +2\cos x$ . If we tried to use the method directly before multiplying by $r$ we would get $\cos t=3$ and $\sin t =2$ , which is impossible because the max of both of these functions is $1$ . Even if $a, b$ were fractions, such as $\frac {3}{10}$ and $\frac 56$ , they still needed to satisfy $a^2+b^2=1$ . If anything is unclear let me know. Hope this helps.