Home » Blog » Prove an integral formula for a rational function in sine and cosine

Prove an integral formula for a rational function in sine and cosine

Given constants a, b, a_1, b_1 such that ab \neq 0, prove that

    \[ \int \frac{a_1 \sin x + b_1 \cos x}{a \sin x + b \cos x} \, dx = Ax + B \log | a \sin x + b \cos x| + C \]

for some constants A,B,C.


Proof. Define constants A and B by

    \[ A = \frac{aa_1 + bb_1}{a^2+b^2}, \qquad B = \frac{ab_1 - a_1 b}{a^2+b^2}. \]

(Since \ab \neq 0 we know a^2+b^2 \neq 0, so these definitions make sense.) Then

    \begin{align*} A&(a \sin x + b \cos x) + B(a \cos x - b \sin x) \\[10pt]  &= \left( \frac{aa_1 + bb_1}{a^2+b^2} \right) (a \sin x + b \cos x) + \left( \frac{ab_1 - a_1 b}{a^2+b^2} \right) (a \cos x - b \sin x) \\[10pt]  &= \frac{a^2 a_1 + abb_1}{a^2+b^2} \sin x + \frac{aba_1 + b^2 b_1}{a^2+b^2} \cos x + \frac{a^2 b_1 - aba_1}{a^2+b^2} \cos x - \frac{abb_1 - a_1 b^2}{a^2+b^2} \sin x \\[10pt]  &= \frac{a^2 a_1 + abb_1 - abb_1 + a_1b^2}{a^2+b^2} \sin x + \frac{aba_1 + b^2 b_1 + a^2 b_1 - aba_1}{a^2+b^2} \cos x \\[10pt]  &= a_1 \sin x + b_1 \cos x. \end{align*}

Therefore, we may write,

    \[ a_1 \sin x + b_1 \cos x = A(a \sin x + b \cos x) + B(a \cos x - b \sin x). \]

So, to evaluate the integral we have

    \begin{align*}  \int &\frac{a_1 \sin x + b_1 \cos x}{a \sin x + b \cos x} \, dx \\[10pt]  &= \int \frac{A(a \sin x + b \cos x) + B(a \cos x - b \sin x)}{a \sin x + b \cos x} \, dx \\[10pt]  &= A \int \, dx + B \int \frac{a \cos x - b \sin x}{a \sin x + b \cos x} \, dx.  \end{align*}

For the integral on the right, we make the substitution u = a \sin x + b \cos x, so du = a \cos x - b \sin x \, dx. Therefore,

    \begin{align*}  \int &\frac{a_1 \sin x + b_1 \cos x}{a \sin x + b \cos x} \, dx \\[10pt]  &= Ax + B \int \frac{du}{u} \\[10pt]  &= Ax + \log |u| + C \\[10pt]  &= Ax + \log |a \sin x + b \cos x| + C.\qquad \blacksquare \end{align*}

Point out an error, ask a question, offer an alternative solution (to use Latex type [latexpage] at the top of your comment):