Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm trying to find the indefinite integral of $$f(x) = \begin{cases} \sin x & x<\pi/4 \\ \cos x & x\ge \pi/4 \\ \end{cases}$$

In all of $\Bbb R$. It seems continuous at $\frac{\pi}4$ and everywhere else, so it should have a definite integral. I intuitively think of something like: $$F(x) = \begin{cases} -\cos x+C_1 & x<\pi/4 \\ \sin x+C_2 & x\ge \pi/4 \\ \end{cases}$$

So I indeed recover $f(x)$ by differentiating $F(x)$ everywhere but at $\frac\pi 4$ (At which point it's not continuous) and I'm wondering if that's a problem. I'm new to this kind of integration..

Thanks for your help!

Edit: At this point I'm thinking this family of functions will work: $F(x)=\begin{cases} -\cos x + \sqrt2 +C & x<\pi/4 \\ \sin x + C& x\ge \pi/4 \\ \end{cases}$

For some $C\in \Bbb R$. Thoughts?

share|improve this question
    
I see. So there's no requirement for it to be differentiable at $\frac\pi 4$ then? Only continuous? Why is that? –  Adar Hefer Mar 1 '13 at 15:53
    
No, it has to be differentiable at $\pi/4$. But if it is continuous at $\pi/4$, in this special case, it turns out it will be automatically differentiable at $\pi/4$. That's a special case! –  1015 Mar 1 '13 at 16:31
    
Alright, I see. Thanks for the clarification. –  Adar Hefer Mar 1 '13 at 16:32

2 Answers 2

up vote 3 down vote accepted

The best and fastest route to find the antiderivatives is the one taken by Andre Nicolas. This answer shows how to go from where the OP stopped.

Yes, that's a problem.

You first need to adjust the constants so that your antiderivative be continuous at $\pi/4$, hence on $\mathbb{R}$.

Equate the right and the left limits with $F(\pi/4)$ to find the condition on $C_1$ and $C_2$.

Then you need to check that $F$ is differentiable with derivative $f$ on $\mathbb{R}$. On $\mathbb{R}\setminus \{\pi/4\}$, this is obvious. At $\pi/4$, you have $$ \lim_{\pi^+/4}F'(x)=\lim_{\pi^-/4}F'(x)=f(\pi/4). $$ So $F$ is indeed differentiable at $\pi/4$ with derivative $f(\pi/4)$. This method is slightly shorter than computing the limit of $(F(x)-F(\pi/4))/(x-\pi/4)$.

share|improve this answer
    
Nice julien.... –  Babak S. Mar 1 '13 at 15:59
    
Right, brilliant! –  Adar Hefer Mar 1 '13 at 16:03
    
So would $F(x) = \begin{cases} -\cos x + \sqrt2 & x<\pi/4 \\ \sin x & x\ge \pi/4 \\ \end{cases}$ Do the trick? Is that the only function that its derivative is $f(x)$? –  Adar Hefer Mar 1 '13 at 16:07
    
Or maybe now I can add a constant to both cases: F(x) = \begin{cases} -\cos x + \sqrt2 +C & x<\pi/4 \\ \sin x + C& x\ge \pi/4 \\ \end{cases}. Now it seems okay, I think. –  Adar Hefer Mar 1 '13 at 16:16
    
@AdarHefer Yes. There you go. –  1015 Mar 1 '13 at 16:29

After we have found one antiderivative, getting them all is mechanical. Let $f(x)$ be our function. Since $f$ is continuous everywhere, one antiderivative $F(x)$ is given by $$F(x)=\int_a^x f(t)\,dt,$$ where $a$ is a constant. Now we are finished.

But if we want an explicit formula, pick any $a$ you like. For example, the choice $a=0$ is not unreasonable.

Then for $x\le \frac{\pi}{4}$, we get $F(x)=\int_0^x \sin t\,dt=1-\cos x$. For $x \ge \frac{\pi}{4}$, we get $F(x)=\int_0^{\pi/4} \sin t\,dt +\int_{\pi/4}^x \cos t \,dt=1-\frac{2}{\sqrt{2}}+\sin x$.

It is more elegant to let $a=\frac{\pi}{4}$. That gives $F(x)=-\cos x+\frac{1}{\sqrt{2}}$ if $x\le \frac{\pi}{4}$, and $F(x)=\sin x-\frac{1}{\sqrt{2}}$ for $x\ge \frac{\pi}{4}$.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.