## Search This Blog

### Solving the integrals $\int \sin^mx \cdot \cos^nx \cdot dx$

In this post we look at solving the integrals of the form

$$I(m,n) = \int \sin^mx \cdot \cos^nx \cdot dx \tag{1}$$

where $m,\ n$ are whole numbers (not necessarily positive).

This is usually done by applying some of the recurrence formulas listed below.

$$I(m,n) = \frac{1}{m+1} \sin^{m+1}x \cos^{n-1}x + \frac{n-1}{m+1} \cdot I(m+2, n-2), for\ \ m \ne -1 \tag{2}$$

$$I(m,n) = -\frac{1}{n+1} \sin^{m-1}x \cos^{n+1}x + \frac{m-1}{n+1} \cdot I(m-2, n+2), for\ \ n \ne -1 \tag{3}$$

$$I(m,n) = I(m-2,n) - I(m-2,n+2), for\ any \ m,n \tag{4}$$

$$I(m,n) = I(m,n-2) - I(m+2,n-2), for\ any \ m,n \tag{5}$$

Then from (2) and (5) we derive (2'), while from (3) and (4) we derive (3'). The formulas (2') and (3') are used to reduce the degree either of the sine or of the cosine. They turn out to be very useful when $m,n$ are positive.

$$I(m,n) = \frac{1}{m+n} \sin^{m+1}x\cos^{n-1}x + \frac{n-1}{m+n} \cdot I(m, n-2),\ for \ m \ne -1,\ m+n \ne 0 \tag{2'}$$

$$I(m,n) = -\frac{1}{m+n} \sin^{m-1}x\cos^{n+1}x + \frac{m-1}{m+n} \cdot I(m-2, n),\ for \ n \ne -1,\ m+n \ne 0 \tag{3'}$$

When both $m, n$ are non-negative usually it is useful to apply formula (6). Note though that (6) is valid for any values of $m,n$, and not just for non-negative values.

$$I(m,n) = I(m+2, n) + I(m, n+2) \tag{6}$$

The last two formulas (2'') and (3'') can be easily derived from (2') and (3'). They allow us to increase the degree of the sine or of the cosine. They are usually used when $m$ or $n$ is negative.

$$I(m,n) = -\frac{1}{n+1} \sin^{m+1}x\cos^{n+1}x + \frac{m+n+2}{n+1} \cdot I(m, n+2),\ for \ m \ne -1,\ n \ne -1 \tag{2''}$$

$$I(m,n) = \frac{1}{m+1} \sin^{m+1}x\cos^{n+1}x + \frac{m+n+2}{m+1} \cdot I(m+2, n),\ for \ m \ne -1,\ n \ne -1 \tag{3''}$$

It can be proved that using these formulas the calculation of the integral (1) always boils down to calculating one of the below given integrals. These integrals below are calculated directly (e.g. by integration by parts or by even simpler means).

$$\int \sin{x}\ dx = -\cos{x}$$

$$\int \cos{x}\ dx = \sin{x}$$

$$\int \frac{dx}{\sin{x}} = \ln |\tan ({\frac{x}{2})}|$$

$$\int \frac{dx}{\cos{x}} = \ln |\tan {(\frac{x}{2}+\frac{\pi}{4})}|$$

$$\int \sin{x}\ \cos{x}\ dx = -\frac{1}{4}\cos{2x}$$

$$\int \frac{dx}{\sin{x}\cos{x}} = \ln |\tan {(x)}|$$

$$\int \frac{\sin{x}}{\cos{x}}\ dx = - \ln |\cos{x}|$$

$$\int \frac{\cos{x}}{\sin{x}}\ dx = \ln |\sin{x}|$$

$$\int \sin^2{x}\ dx = \frac{1}{2}x - \frac{1}{4}\sin{2x}$$

$$\int \cos^2{x}\ dx = \frac{1}{2}x + \frac{1}{4}\sin{2x}$$

$$\int \frac{dx}{\sin^2{x}} = -\cot{x}$$

$$\int \frac{dx}{\cos^2{x}} = \tan{x}$$

It should be noted that when $m$ is odd we can introduce/enter one of the $\sin{x}$ multipliers under the differential sign (where it becomes $\cos{x}$). Then by letting $t=\cos{x}$ and by using that $\sin^2{x} = 1 - \cos^2{x}$, we get an integral from a rational function of $t$.

Analogically, when $n$ is odd we can introduce/enter one of the $\cos{x}$ multipliers under the differential sign (where it becomes $\sin{x}$). Then by letting $t=\sin{x}$ and by using that $\cos^2{x} = 1 - \sin^2{x}$, we get an integral from a rational function of $t$.

### Sequence defined through an arithmetic mean recurrence

There is this nice problem about sequences which I've encountered several times while solving problems in real analysis.

Two constant real numbers $a,b$ are given and then we have this sequence defined as:

$$a_0 = a$$

$$a_1 = b$$

$$a_{n+2} = \frac{a_{n+1} + a_n}{2},\ \ \ n \ge 0$$

Prove that the sequence converges and find the limit $L = \lim_{n \to \infty} a_n$

I won't post the solution here but... it turns out the limit is this number

$$L = \frac{1}{3} \cdot a + \frac{2}{3} \cdot b$$

Here is a nice illustration of this fact generated by a Python program.

In this case (depicted on the picture) the limit is $$\frac{1}{3} \cdot 10 + \frac{2}{3} \cdot 100 = \frac{1}{3} (10 + 200) = \frac{210}{3} = 70$$

### Basic indefinite integrals

(1) Basic indefinite integrals:

$$\int x^a \ dx = \frac{x^{a+1}}{a+1} \ \ \ \ \ (a \ne -1) \tag{1}$$

$$\int \frac{1}{x}\ dx = \ln{\left|x\right|} \ \ \ \ \ \tag{2}$$

$$\int \sin{x}\ dx = -\cos{x} \ \ \ \ \ \tag{3}$$

$$\int \cos{x}\ dx = \sin{x} \ \ \ \ \ \tag{4}$$

$$\int \frac{1}{\cos^2{x}}\ dx = \tan{x} \tag{5}$$

$$\int \frac{1}{\sin^2{x}}\ dx = -\cot{x} \tag{6}$$

$$\int {\rm e}^x \ dx = {\rm e}^x \tag{7}$$

$$\int \frac{1}{1+x^2}\ dx = \arctan{x} \tag{8}$$

$$\int \frac{1}{\sqrt{1-x^2}}\ dx = \arcsin{x} \tag{9}$$

$$\int \frac{1}{\sqrt{x^2 + a}}\ dx = \ln {\left|x + \sqrt {x^2 + a}\right|} \ \ \ \ \ (a \ne 0) \tag{10}$$

Note that these formulas are valid for those values of $x$ for which the integrand function is defined. E.g. $(1)$, $(3)$, $(4)$ are valid for all $x$, $(2)$ is valid for non-zero values of $x$, $(5)$ is valid for values of $x$ such that $\cos{x} \ne 0$.

(2) Additional indefinite integrals:

These three integrals are quite important and often met. The formulas below can be derived via integration by parts.

$$\int \sqrt{a^2-x^2}\ dx = \frac{1}{2} ( x \sqrt {a^2-x^2} + a^2 \arcsin {\frac{x}{a}} ) \ \ \ \ \ \ (a \gt 0, \left|x\right| \lt a) \tag{1'}$$

$$\int \sqrt{x^2-a^2}\ dx = \frac{1}{2} ( x \sqrt {x^2-a^2} - a^2 \ln {\left|x + \sqrt {x^2-a^2}\right|} ) \ \ \ \ \ \ (a \gt 0, \left|x\right| \gt a) \tag{2'}$$

$$\int \sqrt{x^2+a^2}\ dx = \frac{1}{2} ( x \sqrt {x^2+a^2} + a^2 \ln {\left|x + \sqrt {x^2+a^2}\right|} ) \ \ \ \ \ \ (a \gt 0) \tag{3'}$$

(3) Another additional indefinite integral

Let us suppose we are given this integral which we want to calculate. This one is often met when trying to integrate rational functions.

$$I(a, n) = \int \frac{dx}{(a^2+x^2)^n}$$

For this integral, one can prove via integration by parts the following recurrent relation:

$$I(a, n) = \frac{1}{a^2}\cdot\frac{2n-3}{2n-2}\cdot I(a, n-1) + \frac{1}{(2n-2)a^2} \cdot \frac{x}{(a^2+x^2)^{n-1}}$$

Also, it is easy to see that:

$$I(a,1) = \frac{1}{a} \cdot \arctan{\frac{x}{a}}$$

The last two identities give us a procedure for calculating the integrals $I(a, n)$.

### Mean value theorem proof illustrated

I was rereading recently the proof of the mean value theorem from math real analysis.

This led me to the idea to generate some drawing which nicely illustrates the idea of the proof. Let's first restate the mean value theorem.

Theorem: If the function $f$ is defined and continuous in the closed interval $[a,b]$ and is differentiable in the open interval $(a,b)$, then there exists a point $\theta$ which is strictly between $a$ and $b$ i.e. $a \lt \theta \lt b$, such that

$$f'(\theta) = \frac{f(b)-f(a)}{b-a} \tag{1}$$

The proof constructs a function and I was wondering what the idea is behind that function. So I finally understood that and wanted to illustrate it here via some nice drawing. It took me some time to find a good looking function but OK... I finally picked this one:

$$f(x) = \sin(t) - \sin^2(t/2) + \cos^3(t/5) \tag{2}$$

Here is the drawing I generated.

The given function $f(x)$ is shown in red in the figure above.

The proof of the theorem is quite nice. Main role in it plays the the line which connects the two endpoints of the graph of $f(x)$ i.e. the points $(a,f(a))$ and $(b,f(b))$. This line is represented by the function

$$g(x) = f(a) + \frac{f(b)-f(a)}{b-a}(x-a) \tag{3}$$

The line is shown in green in the figure above.

The proof then goes on to construct the function $h(x) = f(x)-g(x)$ and for this one it can be easily seen that $h(a)=h(b)=0$. The proof then applies Rolle's theorem to the function $h$ to get the desired result.

So I was wondering how this function $h(x)$looks like. It is shown in deep sky blue in the figure above. The interesting thing about this function $h(x)$ is that it measures (at each point $x$) what the difference is between $f(x)$ and $g(x)$.

In simple words this can be formulated in 2 different ways:
a) At any value of $x$ the point $(x,h(x))$ is as far from the X axis, as $(x,f(x))$ is from $(x,g(x))$.
This follows from the fact that: $h(x) = f(x) - g(x)$ which can be informally stated as blue = red - green.
b) At any value of $x$ the point $(x,f(x))$ is as far from $(x,h(x))$, as $(x,g(x))$ is from the X axis.
This follows from the fact that: $f(x) - h(x) = g(x)$ which can be informally stated as red blue = green.

### The function $f(x) = x^x$

Let us look at this function

$$f(x) = x^x \tag{1}$$

and try to find its derivative for real values of $x$.

Before this we should mention that this function is well defined only when $x \gt 0$.

In other words... to avoid any complications we are looking at this function only for positive values of $x$.

I. How do we go about finding the derivative $f'(x) = (x^x)'$ ?

Well, we will use the following identity

$$a^x = e^{x \cdot \ln a} \tag{2}$$

which is well-known from high school math and which holds true for any $a \gt 0$ and any $x \in \mathbb{R}$.

Substituting $a = x$ in this identity we subsequently get

$$f(x) = x^x = e ^ {x \cdot \ln x}$$

$$f'(x) = e ^ {x \cdot \ln x} \cdot (x \cdot \ln x)'$$

$$f'(x) = e ^ {x \cdot \ln x} \cdot (1 \cdot \ln x + x \cdot \frac{1}{x})$$

$$f'(x) = e ^ {x \cdot \ln x} \cdot (\ln x + 1)$$

$$f'(x) = x ^ x \cdot (\ln x + 1) \tag{3}$$

The last equation $(3)$ gives us the derivative which we wanted to find.

In the above derivation we used several simple facts from math analysis.

$$(e^x)' = e^x$$

$$(f(g(x)))' = f'(g(x)) \cdot g'(x)$$

$$(u(x) \cdot v(x))' = u'(x) \cdot v(x) + u(x) \cdot v'(x)$$

Finally let us restate the above established formula.

$$\large { (x^x)' = x ^ x \cdot (\ln x + 1) } \tag{4}$$

II. How do we find $\displaystyle{ \lim_{x \to 0^{+}} f(x) } = \displaystyle{ \lim_{x \to 0^{+}} x^x }$ ?

I think the easiest way of finding this limit which I have seen is by letting $x=e^{-t}$ where $t$ is some very large positive number. Then we easily get the following.

$$\lim_{x \to 0^{+}} f(x) = \lim_{x \to 0^{+}} x^x = \lim_{x \to 0^{+}} e ^ {x \cdot \ln x} = \lim_{x \to 0^{+}} e ^ {(\ln x) \cdot x} =$$

$$= \lim_{t \to \infty} e^{(-t) \cdot e^{-t} } = \lim_{t \to \infty} e^{ \frac{(-t)}{e^{t}} } = e ^ {\lim_{t \to \infty} \frac{(-t)}{e^{t} } } = e^0 = 1$$

Here the main fact which we used was that

$$\lim_{t \to \infty} \frac{(-t)}{e^{t} } = 0$$

which is quite obvious given that the numerator is a polynomial of $t$ and the denominator is the exponential function $e^t$.

This way we have just calculated this quite remarkable limit

$$\large \lim_{x \to 0^{+}} x^x = 1 \tag{5}$$

Finally... here is a video demonstrating nicely an informal numerical approach to finding the same limit What is 0 to the power of 0?

### Euler's identity for $\frac{sin(x)}{x}$

Here is this famous identity due to Euler.

$$\frac{\sin x}{x} = \prod_{k=1}^{\infty} \cos \left(\frac{x}{2^k} \right) \tag{1}$$

This holds true for every $x \ne 0$.

Let's prove it.

Denote:

$$S(n) = \prod_{k=1}^{n} \cos \left(\frac{x}{2^k} \right) \tag{2}$$

Multiplying the two sides by $sin{\frac{x}{2^n}}$ we sequentially get:

$$sin{\frac{x}{2^n}} \cdot S(n) = sin{\frac{x}{2^{n}}} \cdot \prod_{k=1}^{n} \cos \left(\frac{x}{2^k} \right)$$
$$sin{\frac{x}{2^n}} \cdot S(n) = sin{\frac{x}{2^{n-1}}} \cdot \frac{1}{2^1} \cdot \prod_{k=1}^{n-1} \cos \left(\frac{x}{2^k} \right)$$
$$sin{\frac{x}{2^n}} \cdot S(n) = sin{\frac{x}{2^{n-2}}} \cdot \frac{1}{2^2} \cdot \prod_{k=1}^{n-2} \cos \left(\frac{x}{2^k} \right)$$
$$...$$
$$sin{\frac{x}{2^n}} \cdot S(n) = sin{\frac{x}{2^{1}}} \cdot \frac{1}{2^{n-1}} \cdot \prod_{k=1}^{1} \cos \left(\frac{x}{2^k} \right)$$

The last one obviously gives us:

$$sin{\frac{x}{2^n}} \cdot S(n) = \frac{1}{2^{n}} \cdot sin(x) \tag{2}$$

which can be easily reworked to:

$$\large{ \frac{sin{\frac{x}{2^n}}}{\frac{x}{2^n}} \cdot S(n) = \frac{sin(x)}{x}} \tag{3}$$

Now in $(3)$ when we take the limit as ${n\to\infty}$ while using that

$$\lim_{u \to 0} \frac{sin(u)}{u} = 1$$

we get equality $(1)$ which is what we wanted to prove.

### Trigonometric identities

1) Even/Odd function identities

$$\sin(-\alpha) = -\sin\alpha \tag{1.1}$$
$$\cos(-\alpha) = \cos\alpha \tag{1.2}$$
$$\tan(-\alpha) = -\tan\alpha \tag{1.3}$$
$$\cot(-\alpha) = -\cot\alpha \tag{1.4}$$

$$\sin(\alpha + \beta) = \sin\alpha\cos\beta + \cos\alpha\sin\beta \tag{2.1}$$
$$\sin(\alpha - \beta) = \sin\alpha\cos\beta - \cos\alpha\sin\beta \tag{2.2}$$
$$\cos(\alpha + \beta) = \cos\alpha\cos\beta - \sin\alpha\sin\beta \tag{2.3}$$
$$\cos(\alpha - \beta) = \cos\alpha\cos\beta + \sin\alpha\sin\beta \tag{2.4}$$

$$\tan(\alpha + \beta) = \frac{\tan\alpha+\tan\beta}{1-\tan\alpha\tan\beta}\tag{2.5}$$

$$\cot(\alpha + \beta) = \frac{\cot\alpha\cot\beta-1}{\cot\alpha+\cot\beta}\tag{2.6}$$

3) Sum to product identities

$$\sin\alpha + \sin\beta = 2 \sin\frac{\alpha+\beta}{2}\cos\frac{\alpha-\beta}{2} \tag{3.1}$$
$$\sin\alpha - \sin\beta = 2 \sin\frac{\alpha-\beta}{2}\cos\frac{\alpha+\beta}{2} \tag{3.2}$$

$$\cos\alpha + \cos\beta = 2 \cos\frac{\alpha+\beta}{2}\cos\frac{\alpha-\beta}{2} \tag{3.3}$$

$$\cos\alpha - \cos\beta = -2 \sin\frac{\alpha+\beta}{2}\sin\frac{\alpha-\beta}{2} \tag{3.4}$$

$$\tan\alpha \pm \tan\beta = \frac{\sin{(\alpha\pm\beta)}}{\cos\alpha\cos\beta} \tag{3.5}$$
$$\cot\alpha \pm \cot\beta = \frac{\sin{(\beta\pm\alpha)}}{\sin\alpha\sin\beta} \tag{3.6}$$

4) Product to sum identities

$$\sin\alpha\sin\beta = \frac{1}{2}[\cos(\alpha-\beta) - \cos(\alpha+\beta)] \tag{4.1}$$

$$\cos\alpha\cos\beta = \frac{1}{2}[\cos(\alpha-\beta) + \cos(\alpha+\beta)] \tag{4.2}$$

$$\sin\alpha\cos\beta = \frac{1}{2}[\sin(\alpha+\beta) + \sin(\alpha-\beta)] \tag{4.3}$$

5) Double-angle and triple-angle identities

$$\sin 2 \alpha = 2 \sin\alpha \cos\alpha \tag{5.1}$$

$$\cos 2 \alpha = \cos^2\alpha - \sin^2\alpha \tag{5.2}$$

$$\tan 2 \alpha = \frac{2\tan\alpha}{1-\tan^2\alpha} = \frac{2}{\cot\alpha - \tan\alpha} \tag{5.3}$$

$$\cot 2 \alpha = \frac{\cot^2\alpha-1}{2\cot\alpha} = \frac{\cot\alpha - \tan\alpha}{2} \tag{5.4}$$

$$\sin 3 \alpha = 3 \sin\alpha - 4\sin^3 \alpha \tag{5.5}$$

$$\cos 3 \alpha = 4\cos^3 \alpha - 3 \cos\alpha \tag{5.6}$$

$$\tan 3 \alpha = \frac{3\tan \alpha - \tan^3 \alpha}{1 - 3 \tan^2 \alpha} \tag{5.7}$$

$$\cot 3 \alpha = \frac{\cot^3 \alpha - 3 \cot \alpha}{3\cot^2 \alpha - 1} \tag{5.8}$$

6) Decreasing the power of sine and cosine

$$2 \sin^2 \alpha = 1 - \cos 2\alpha \tag{6.1}$$

$$4 \sin^3 \alpha = 3 \sin \alpha - \sin 3\alpha \tag{6.2}$$

$$8 \sin^4 \alpha = \cos 4\alpha - 4 \cos 2\alpha + 3 \tag{6.3}$$

$$2 \cos^2 \alpha = 1 + \cos 2\alpha \tag{6.4}$$

$$4 \cos^3 \alpha = 3 \cos \alpha + \cos 3\alpha \tag{6.5}$$

$$8 \cos^4 \alpha = \cos 4\alpha + 4 \cos 2\alpha + 3 \tag{6.6}$$

### Fun problem on Ceva's theorem

Problem:

Given is $\Delta ABC$. The points $D \in BC$, $E \in CA$, $F \in AB$ are such that the lines $AD,BE,CF$ are concurrent.

$A'$ - midpoint of $BC$
$B'$ - midpoint of $CA$
$C'$ - midpoint of $AB$

$D'$ - midpoint of $AD$
$E'$ - midpoint of $BE$
$F'$ - midpoint of $CF$

Prove that the lines

$A'D', B'E', C'F'$ are also concurrent (i.e. that they pass through a common point).

Solution:

It is crucial to come up with a nice realistic drawing here.

Also, it is important to realize that:
a) $A', F', B'$ are on one line
b) $B', D', C'$ are on one line
c) $C', E', A'$ are on one line

From Ceva's theorem for triangle $ABC$ we get:
$$\frac{AF}{FB}\frac{BD}{DC}\frac{CE}{EA} = 1 \tag{1}$$

Now the trick is to realize that:
$$\frac{B'F'}{F'A'} = \frac{AF}{FB} \tag{2}$$
$$\frac{C'D'}{D'B'} = \frac{BD}{DC} \tag{3}$$
$$\frac{A'E'}{E'C'} = \frac{CE}{EA} \tag{4}$$

Why is this so?

Because $B'C' || BC$   , $C'A' || CA$ and  $A'B' || AB$
so these relations follow from the Intercept theorem.

Multiplying the last 3 equations and using $(1)$ we get:

$$\frac{B'F'}{F'A'}\frac{C'D'}{D'B'}\frac{A'E'}{E'C'} = \frac{AF}{FB}\frac{BD}{DC}\frac{CE}{EA} = 1$$

Thus:

$$\frac{B'F'}{F'A'}\frac{A'E'}{E'C'}\frac{C'D'}{D'B'} = 1 \tag{5}$$

Now using the converse Ceva's theorem (for the triangle $A'B'C'$ and for the points $D', E', F'$), we can conclude from $(5)$ that the three lines  $A'D', B'E', C'F'$ intersect at a single/common point. This is what we had to prove hence the problem is solved.