# Find absolute minimum of f(x)=sin(x)-cos(x) on [0,pi]

1. Feb 23, 2016

### FatMarrow

1. The problem statement, all variables and given/known data
Find the absolute minimum of f(x)=sin(x)-cos(x) on [0,pi]

2. Relevant equations
-

3. The attempt at a solution
I know the answer is 0 from looking at a graph, but I cannot figure out how to express my workings algebraically. The end goal of this is to do a presentation on how I figured out the answer and I don't think I can really just get up and draw a graph on sin(x)-cos(x) and then just point at 0. So far I've managed to get the first derivative and find x=-pi/4. From here I just don't know what to do.

2. Feb 23, 2016

### SteamKing

Staff Emeritus
Have you calculated f(0)? I think that x = 0 falls in your interval and f(0) < 0.

3. Feb 23, 2016

### Staff: Mentor

What is the equation for $\sin (x - \pi/4)$ in terms of sines and cosines of x and pi/4?

4. Feb 23, 2016

### FatMarrow

sin(x)cos(pi/4) - sin(pi/4)cos(x)

I feel like I'm missing something really obvious here.

5. Feb 23, 2016

### SteamKing

Staff Emeritus
You are. Check Post #2.

6. Feb 23, 2016

### Staff: Mentor

What are the values of sin(pi/4) and cos(pi/4)?

7. Feb 23, 2016

### FatMarrow

Yup, I read that as something else, not sure what but thank you nonetheless.

8. Feb 23, 2016

### FatMarrow

Theyre both equal to root 2 / 2 so now you have:
root 2 / 2(sinx - cosx)
But I'm failing to see where to go from that. Do you equate it to 0 and then get x=0 or 1?

9. Feb 23, 2016

### Staff: Mentor

$$\sin{x}-\cos{x}=\sqrt{2}\sin\left(x-\frac{\pi}{4}\right)=\sqrt{2}\sin\theta$$
where $\theta=x-\frac{\pi}{4}$. What is the minimum value of $\sin\theta$ between $\theta=-\frac{\pi}{4}$ and $\theta=+\frac{3\pi}{4}$?

Last edited: Feb 23, 2016
10. Feb 23, 2016

### SteamKing

Staff Emeritus
IDK what graph you were looking at which told you that the abs. minimum of f(x) = sin(x) - cos(x) was zero on [0, π], but that graph was wrong.

f(0) = sin (0) - cos (0) < 0

You can check this by using Wolfram Alpha online to plot this function, for example.

It's not what you don't know that's the problem, it's what you know that just ain't so that gets you into trouble.

11. Feb 24, 2016

### Ray Vickson

There is an easy way and a less-easy way. Chestermiller has outlined the easiest way, but if you know some calculus, there is an alternative method. The minimum will either be at an endpoint ($x = 0$ or $x = \pi$), or else at an interior point $0 < x < \pi$. At an interior-point optimum $x = x_0$ of $f(x) = \sin(x) - \cos(x)$ you need $df/dx|_{x=x_0} = 0$, giving $\tan(x_0) = -1$. You ought to be able to solve that (on $0 < x_0 < \pi$) graphically, by locating on the unit circle the corresponding $(\cos(x_0), \sin(x_0)$. There are no other points in $(0, \pi)$ where the derivative vanishes.

So, the minimum is either at $x = 0$ or at $x = \pi$ or at $x = x_0$. You can just go ahead and evaluate $f(x)$ at all three points, and pick the best value. Alternatively, you can perform a second-derivative test to conclude that $x_0$ maximizes $f(x)$, so cannot be the minimizing point. That leaves just the two points $x = 0, \pi$ to check.

Last edited: Feb 24, 2016
12. Feb 24, 2016

### Staff: Mentor

Hi Ray,

I guess you didn't like the method I suggested in post #9?

Chet

13. Feb 24, 2016

### LCKurtz

The first thing I would suggest is that you notice that $x = -\frac \pi 4$ is not on your interval. Can you find any critical points that are on the given interval $[0,\pi]$? Now, others have given you hints which you don't seem to get, so, alternatively, I would remind you that you have a closed interval domain, so the min must occur at a critical point on the interval or at an end point. If you find a critical point on the interval, it and the end points are all you need to check to find both the max and min on the interval.

[Edit:] I took way too long to type this so I didn't see Ray's post.

14. Feb 24, 2016

### Ray Vickson

I never said anything of the sort, and I even acknowledged your approach as being the simplest. However, the OP did not seem to connect to that approach, at least not right away. Outlining an alternative is not the same thing as rejecting something. You and I both know how to solve this problem, but the OP seems unsure.

15. Feb 24, 2016

### Staff: Mentor

You said something about SteamKing's method, but not mine, and I just thought you had not noticed it.

Chet

16. Feb 24, 2016

### Ray Vickson

I am truly sorry: I meant you, but mis-attributed the contribution.

I have edited the incorrect attribution.

Last edited: Feb 24, 2016