# Evaluating $\int {\sin \theta + \cos \theta \over \sqrt{\sin 2\theta} }d\theta$

$$\int {\sin \theta + \cos \theta \over \sqrt{\sin 2\theta} }d\theta$$

After simplifying I get,

$${1\over \sqrt{2}}\int {\tan \theta + 1 \over \sqrt{\tan \theta}} d\theta$$

Substituting $u = \tan \theta$

$${1\over \sqrt{2}}\int {u + 1\over \sqrt{u}(1 + u^2)} du$$

Substituting $t^2 = u$

$${\sqrt{2}}\int {t^2 + 1\over (1 + t^4)} dt = \sqrt{2} \int {1 + 1/t^2 \over(t - 1/t)^2 + 2 }dt$$

Substituting $z = t - 1/t$

$$\sqrt{2} \int {1\over z^2 + 2 }dz = \arctan\left(\tan \theta - 1\over \sqrt{2\tan \theta} \right) + C = {\arcsin(2\sqrt{\sin2\theta} (\sin\theta - \cos \theta))\over 2} + C$$

Which is far from the right answer of $\arcsin(\sin \theta - \cos \theta) + C$.

Where did I go wrong ?

Edit :

I would like to know where I am wrong rather than knowing how to solve the problem.

• I don't understand your initial ‘simplification’. – Bernard Apr 23 '17 at 13:29
• I suppose you mean $u=t^2$? – GoodDeeds Apr 23 '17 at 13:32
• @Bernard $${\sin \theta + \cos \theta\over \sqrt{\sin 2\theta}} = {\sin \theta + \cos \theta\over \sqrt{2\sin \theta\cos \theta}} = {\sin \theta \over \sqrt{2\sin \theta\cos \theta}} + {\cos \theta \over \sqrt{2\sin \theta\cos \theta}}$$ – A---B Apr 23 '17 at 13:58
• @GoodDeeds Thank you I edited it. – A---B Apr 23 '17 at 13:59
• Can you add how you converted arctan to arcsin. – Kanwaljit Singh Apr 23 '17 at 14:59

Your factor before $\arctan$ should be $1$ rather than $1/2$; except for that, your antiderivative is correct. The error is in the conversion to $\arcsin$. If you use $\arctan \alpha = \arcsin(\alpha/\sqrt{\alpha^2+1})$, you will get the right answer.

Update: Now that the factor 1/2 has been edited away, things are fine up to that point. And actually the last step is almost OK too! (I dismissed it a bit too quickly before.)

The question is only meaningful on an interval where $\sin 2\theta \ge 0$, say $0 \le \theta \le \pi/2$, and the answer $A=\arcsin(\sin\theta-\cos\theta)$ is correct on that whole interval, as is easily verified by differentiation (and note also that $|\sin\theta-\cos\theta| \le 1$ on that interval).

Now it seems that your expression $B$ actually agrees with the expression $A$ on the subinterval $\pi/12 \le \theta \le 5\pi/12$, whereas $B=\text{const.}-A$ on the intervals $0\le \theta \le \pi/12$ and $\le 5\pi/12 \le \theta \le \pi/2$. I haven't really bothered to analyze why this happens, I was just lazy and looked at plots of $A \pm B$. But surely (as Barry Cipra pointed out) it has something to do with the properties of the inverse trig functions; for example $\arcsin(\sin x) = \pi-x$ if $\pi/2 \le x \le \pi$.

• I used $$\sin 2y = {2\tan y \over 1 + \tan^2 y}$$, why is this wrong ? – A---B Apr 23 '17 at 15:09
• I am already seeing this property math.stackexchange.com/questions/254561/… and trying to proceed. But it becomes complex. Can you show complete answer. – Kanwaljit Singh Apr 23 '17 at 15:21
• @A---B: See the updated answer for some more thoughts. – Hans Lundmark Apr 24 '17 at 5:46
• @KanwaljitSingh: It's nothing deep, just draw a right triangle with legs $1$ and $\alpha$. – Hans Lundmark Apr 24 '17 at 5:49

Hint -

Put $$\sin\theta - \cos \theta = t$$

$$(\cos \theta + \sin \theta)\text{d}\theta = \text{d}t$$

Also on squaring above equation,

$$\sin^2\theta + \cos^2 \theta - 2 \sin \theta \cos \theta = t^2$$

$$1 - \sin2\theta = t^2$$

$$\sin2\theta = 1 - t^2$$

Then given integral becomes,

$$\int \frac{1}{\sqrt {1-t^2}} \text{d}t$$

Hope now its easy to solve.

• This is my way. – lab bhattacharjee Apr 23 '17 at 13:54
• Thanks for the answer but my question was to identify where I am wrong, can you please tell me ? – A---B Apr 23 '17 at 14:06
• I get the answer as $$\ln|\sqrt{2 - 2\sin \theta\cos \theta} + \sin\theta - \cos \theta|$$. I don't know how to get $\arcsin(\sin \theta - \cos \theta)$ from here. – A---B Apr 24 '17 at 12:07
• Please don't mind but why are you making an easy question so much complex? – Kanwaljit Singh Apr 24 '17 at 14:08
• @KanwaljitSingh No I did not mind :). As far as I know $$\int {1\over \sqrt{1 + t^2}} dt = \ln|\sqrt{1 + t^2} + t|$$, please correct me if I am wrong. – A---B Apr 24 '17 at 14:30

Hint:

Try the substitution $u=\sin 2\theta$.

• Thank you for the answer but I want to know where I am wrong. – A---B Apr 23 '17 at 14:08
• This does not lead to anywhere as I get $$\frac12\int {1 \over \sqrt{u}(\cos \theta - \sin \theta)} du$$. Now what ? – A---B Apr 24 '17 at 12:04

There appear to be two mistakes, both in the last displayed equation. First,

$$\sqrt2\int{1\over z^2+2}dz=\arctan\left(z\over\sqrt2\right)+C=\arctan\left(\tan\theta-1\over\sqrt{2\tan\theta}\right)+C$$

(i.e., the $1\over2$ in from of the arctan didn't belong there). And second, when you convert arctan to arcsin, you really do get $\arcsin(\sin\theta-\cos\theta)$. I don't know how you got $\arcsin(2\sqrt{\sin2\theta}(\sin\theta-\cos\theta))$, but you can see that it's wrong because it does not differ by a constant from $\arctan((\tan\theta-1)/\sqrt{2\tan\theta})$ for all $0\lt\theta\lt\pi/2$, since both equal $0$ at $\theta=\pi/4$, while $\arcsin(2\sqrt{\sin2\theta}(\sin\theta-\cos\theta))=0$ as $\theta\to0$ whereas

$$\arctan\left(\tan\theta-1\over\sqrt{2\tan\theta}\right)\to-{\pi\over2}\quad\text{as }\theta\to0$$

My recommendation is to have another go at the arctan/arcsin conversion, and if you still don't get the right answer, post your work for that part of the derivation and ping me with a comment so I can take a look at it.

(Remark, added after posting: I was offline composing this, and didn't see Hans Lundmark's answer until just now.)

Added in response to OP's comment: It is true that $y=\arctan((\tan\theta-1)/\sqrt{2\tan\theta})$ implies $\tan y=(\tan\theta-1)/\sqrt{2\tan\theta}$, but it is not always true that $\sin2y=2\tan\theta/(1+\tan^2\theta)$ implies $y={1\over2}\arcsin(2\tan\theta/(1+\tan^2\theta))$. More generally, if $f$ is any of the trig functions (sin, cos, tan, etc.), and $g$ is its inverse (arcsin, arccos, arctan, etc.), then $f(g(x))=x$ is always true but $g(f(x))=x$ is not always true. In other words, when converting from arctan to arcsin, you can't work purely formally; you have to consider the ranges and domains of the functions.

• Wait, I will do that. Thanks for the answer. – A---B Apr 23 '17 at 15:35
• I actually used $$\sin 2y = {2\tan y \over 1 + \tan^2 y}$$ and $$\tan y = {\tan \theta - 1\over \sqrt{2\tan \theta}}$$. Where do you think the error is, in my formula or in my calculation ? – A---B Apr 23 '17 at 15:37