# How do I integrate: $\int\sqrt{\frac{x-3}{2-x}} dx$?

I need to solve:

$$\int\sqrt{\frac{x-3}{2-x}}~{\rm d}x$$

What I did is:

Substitute: $x=2\cos^2 \theta + 3\sin^2 \theta$. Now:

\begin{align} x &= 2 - 2\sin^2 \theta + 3 \sin^2 \theta \\ x &= 2+ \sin^2 \theta \\ \sin \theta &= \sqrt{x-2} \\ \theta &=\sin^{-1}\sqrt{x-2} \end{align}

and, $cos \theta = \sqrt{(3-x)}$

$\theta=\cos^{-1}\sqrt{(3-x)}$

The integral becomes:

\begin{align} &= \int{\sqrt[]{\frac{2\cos^2 \theta + 3\sin^2 \theta-3}{2-2\cos^2 \theta - 3\sin^2 \theta}} ~~(2 \cos \theta\sin\theta)}~{\rm d}{\theta}\\ % &= \int{\sqrt[]{\frac{2\cos^2 \theta + 3(\sin^2 \theta-1)}{2(1-\cos^2 \theta) - 3\sin^2 \theta}}~~(2 \cos \theta\sin\theta)}~{\rm d}{\theta} \\ % &= \int\sqrt[]{\frac{2\cos^2 \theta - 3\cos^2 \theta}{2\sin^2 \theta - 3\sin^2 \theta}}~~(2 \cos \theta\sin\theta) ~{\rm d}\theta \\ % &= \int\sqrt[]{\frac{-\cos^2 \theta }{- \sin^2 \theta}}~~(2 \cos \theta\sin\theta) ~{\rm d}\theta \\ % &= \int \frac{\cos \theta}{\sin\theta}~~(2 \cos \theta\sin\theta)~{\rm d}\theta \\ % &= \int 2\cos^2 \theta~{\rm d}\theta \\ % &= \int (1- \sin 2\theta)~{\rm d}\theta \\ % &= \theta - \frac {\cos 2\theta}{2} + c \\ % &= \sin^{-1}\sqrt{x-2} - \frac {\cos 2(\sin^{-1}\sqrt{x-2})}{2} + c \end{align}

But, The right answer is :

$$\sqrt{\frac{3-x}{x-2}} - \sin^{-1}\sqrt{3-x} + c$$

Where am I doing it wrong?

How do I get it to the correct answer??

UPDATE:

I am so sorry I wrote:

= $\int 2\cos^2 \theta .d\theta$

= $\int (1- \sin 2\theta) .d\theta$

It should be:

= $\int 2\cos^2 \theta .d\theta$

= $\int (1+ \cos2\theta) .d\theta$

= $\theta + \frac{\sin 2\theta}{2} +c$

What do I do next??

UPDATE 2:

= $\theta + \sin \theta \cos\theta +c$

= $\theta + \sin \sin^{-1}\sqrt{(x-2)}. \cos\cos^{-1}\sqrt{(3-x)}+c$

= $\sin^{-1}\sqrt{(x-2)}+ \sqrt{(x-2)}.\sqrt{(3-x)}+c$

Is this the right answer or I have done something wrong?

• Ali.E. told you what was the mistake. In any manner, if I may suggest, when you have computed an antiderivative, compute its derivative to check if you get back to the integrand. Use WA (only foir that !). Cheers. – Claude Leibovici Jan 3 '15 at 9:14
• By the way, you may suppose $x= 2+ \sin^2 \theta$ from the beginning. $x=2\cos^2 \theta + 3\sin^2 \theta$ isn't necessary! – L.G. Jan 3 '15 at 9:32
• I get the result $\sqrt{(x-2)(3-x)}+\arcsin(\sqrt{x-2})+C$. And, differentiating what you say is the right answer don't get me to $\sqrt{(x-3)/(2-x)}$. By the way, for what values of $x$ do you expect this to be real? – mickep Jan 3 '15 at 9:45
• After your update: What you do next is to use the formula $\sin 2z=2\sin z\cos z$. Then simplify. – mickep Jan 3 '15 at 9:47
• @ mickep: It does not matter if it is real, you can simply factor $i=\sqrt(-1)$ to make the rest real! Differentiation of $\sqrt{(3-x)(x-2)} - \sin^{-1} \sqrt{3-x} + c$ results in $\sqrt{(x-3)/(2-x)}$. – L.G. Jan 3 '15 at 10:03

$$I=\int\sqrt{\frac{x-3}{2-x}}~{\rm d}x$$

Integrating Let $x=2\cos^2t+3\sin^2t$, $dx=\sin2tdt$

$$I=\int\sqrt{\frac{-\cos^2t}{-\sin^2t}}\sin2tdt=\int2\cos^2tdt=\int(1+\cos2t)dt=t+\frac12\sin2t+c\\I=\underbrace{\cos^{-1}\sqrt{3-x}}_{\pi/2-\sin^{-1}\sqrt{3-x}}+\sqrt{x-2}\sqrt{3-x}+c\\I=\underbrace{\sqrt{x-2}\sqrt{3-x}}_{\sqrt{5x-x^2-6}}-\sin^{-1}{\sqrt{3-x}}+c'$$

Differentiating back $$I'=\frac1{2\sqrt{(x-2)(3-x)}}\cdot(5-2x)-\underbrace{\frac1{\sqrt{1-(\sqrt{3-x})^2}}}_{\sqrt{x-2}}\cdot\frac1{2\sqrt{3-x}}(-1)\\I'=\frac{2(3-x)}{2\sqrt{(x-2)(3-x)}}=\sqrt{\frac{3-x}{x-2}}=\sqrt{\frac{x-3}{2-x}}$$

Hint:

For solving the integral, notice that $$t^2 = \frac{x-3}{2-x} \Rightarrow dx = -\frac{2t}{(t^2+1)^2}dt.$$ Hence,

$$\int \sqrt{\frac{x-3}{2-x}}dx = -2\int\frac{t^2}{(t^2+1)^2}dt.$$

• I didn't get you. – Nivedita Jan 3 '15 at 9:46
• @Nivedita: He's telling you a simpler route than what you've taken $$\text{Let } t^2 = \frac{x - 3}{2-x} = \frac{x-2 -1}{-(x-2)} = \frac{1}{x-2} - 1$$ Do simple substitution and integrate. – Nick Jan 3 '15 at 9:52
• Got it, thanks @Nick – Nivedita Jan 3 '15 at 10:09

$2(\cos x)^2=1+\cos(2x)$ but $2(\cos x)^2\neq1-\sin(2x)$

to shorten the working, since the function is only well-defined for $x \in (2,3)$ we may substitute $$3-x \to s$$ giving $$I=\int\sqrt{\frac{x-3}{2-x}} .dx = - \int\sqrt{\frac{s}{1-s}} .ds$$ now substitute $$s \to \sin^2 \theta \\ ds \to 2\sin\theta \cos\theta\cdot d\theta$$ so $$I = -\int2\sin^2 \theta \cdot d\theta = \int (\cos 2\theta-1)\cdot d\theta=\frac12\sin2\theta-\theta+c \\ = \sqrt{s(1-s)} - \sin^{-1}s \\ =\sqrt{(3-x)(x-2)} - \sin^{-1} \sqrt{3-x} + c$$

• Differentiation of $\sqrt{(3-x)(x-2)} - \sin^{-1} \sqrt{3-x} + c$ results in $\sqrt{(x-3)/(2-x)}$. – L.G. Jan 3 '15 at 9:59
• I think the correct answer I have mentioned in the question is wrong. It was in a book. – Nivedita Jan 3 '15 at 10:07
• even in books mistakes occur occasionally – David Holden Jan 3 '15 at 10:13