# Solving Difference Equations using Omega CAS Explorer

Maxima’s ‘solve_rec‘ solves difference equation:

Fig. 1 Geometric Sequence

It solves initial-value problem as well:

Fig. 2 Fibonacci Sequence

Mathematica has ‘RSolve‘:

and ‘RSolveValue‘:

# Fire & Water

Question:

When a forrest fire occurs, how many fire fighter should be sent to fight the fire so that the total cost is kept minimum?

Suppose the fire starts at $t=0$; at $t=t_1$, the fire fighter arrives; the fire is extinguished later at $t=t_2$.

Let $c_1, c_2, c_3$ and $x$ denotes the monetary damage per square footage burnt, the hourly wage per fire fighter, the one time cost per fire fighter and the number of fire fighters sent respectively. The total cost consists damage caused by the fire, the wage paid to the fire fighters and the one time cost of the fire fighters:

$c(x) = c_1\cdot$(total square footage burnt) $+\;c_2\cdot (t_2-t_1)\cdot x + c_3\cdot x.$

Notice $t_2-t_1$, the duration of fire fighting.

Assume the fire ignites at a single point and quickly spreads in all directions with flame velocity $v_*$, the growing square footage of engulfed circular area is a function of time. Namely,

$b(t) = \pi r^2 = \pi (v_* t) ^2 = \pi v_*^2 t^2 \overset{k=\pi v_*^2}{=} k t^2.$

Its burning rate

$v_b(t) = b'(t) = 2 k t \overset{\alpha = 2 k}{=} \alpha t.\quad\quad\quad(1)$

However, after the arrival of $x$ fire fighters, $\alpha$ is reduced by $\beta x$, an amount that is directly proportional to the number of fire fighters on the scene. The reduction of $\alpha$ reflects the fire fighting efforts exerted by the crew. As a result, for $t > t_1, v_b(t)$ declines along the line described by

$v_b(t) = (\alpha-\beta x)t + d$

where $\alpha-\beta x <0$. Or equivalently,

$\beta x - \alpha >0.\quad\quad\quad(2)$

Moreover, the fire is extinguished at $t_2$ suggests that

$v_b(t_2) = 0 \implies (\alpha-\beta x) t_2 + d =0 \implies d = -(\alpha-\beta x)t_2.$

i.e.,

$\forall t_1< t \le t_2, v_b(t) = (\alpha-\beta x) t - (\alpha-\beta x) t_2=(\alpha-\beta x) (t-t_2).\quad\quad\quad(3)$

Combine (1) and (3),

$v_b(t) = \begin{cases} \alpha t, \quad\quad\quad\quad\quad\quad\quad\quad0\le t \le t_1\\ (\alpha-\beta x)(t-t_2),\quad\quad t_1< t \le t_2 \end {cases}.$

It is further assumed that

$v_b(t)$ is continuous at $t=t_1.\quad\quad\quad(4)$

We illustrate $v_b(t)$ in Fig. 1.

Fig. 1

The fact that $v_b(t)$ is continuous at $t_1$ means

$\lim\limits_{t \to t_1^+}v_b(t)=(\alpha-\beta x)(t_1-t_2) = \lim\limits_{t \to t_1^-}v_b(t) = h \implies (\alpha-\beta x) (t_1-t_2)=h.$

That is,

$t_2-t_1=\frac{h}{\beta x - \alpha}.\quad\quad\quad(5)$

The area of triangle in Fig. 1 represents $b(t_2)$, the total square footage damaged by the fire. i.e.,

$b(t_2) =\frac{1}{2}t_1 h + \frac{1}{2}(t_2-t_1)h\overset{(5)}{=}\frac{1}{2}t_1 h+ \frac{1}{2}\frac{h^2}{\beta x-\alpha}.\quad\quad\quad(6)$

Consequently, the total cost

$c(x)= c_1 b(t_2) + c_2 x (t_2-t_1) + c_3 x \overset{(6), (5)}{=}\frac{c_1 t_1 h}{2} + \frac{c_1 h^2}{2(\beta x-\alpha)} + \frac{c_2 h x}{\beta x-\alpha} + c_3 x.$

To minimize the total cost, we seek a value $x$ where function $c$ attains its minimum value $c(x)$.

From expressing $x$ as

$x = \frac{1}{\beta}\beta x = \frac{1}{\beta}({\beta x-\alpha +\alpha} )= \frac{1}{\beta}(\beta x -\alpha) + \frac{\alpha}{\beta},$

we obtain

$\frac{c_2 h x}{\beta x-\alpha} = \frac{c_2 h}{\beta x-\alpha}(\frac{1}{\beta}(\beta x - \alpha) + \frac{\alpha}{\beta})=\frac{c_2 h}{\beta} + \frac{c_2 \alpha h}{\beta(\beta x-\alpha)},\quad\quad\quad(7)$

$c_3 x = \frac{c_3}{\beta}(\beta x-\alpha) + \frac{c_3 \alpha}{\beta}.\quad\quad\quad(8)$

It follows that

$c(x) = \underbrace{\frac{c_1 t_1 h}{2} + \frac{c_1 h^2}{2(\beta x-\alpha)}}_{c_1\cdot(6)} + \underbrace{\frac{c_2 h}{\beta}+\frac{c_2 \alpha h}{\beta(\beta x - \alpha)}}_{(7)} + \underbrace{\frac{c_3}{\beta}(\beta x-\alpha) + \frac{c_3 \alpha}{\beta}}_{(8)}$

$=\frac{c_1 t_1 h}{2} + \frac{c_2 h}{\beta} + \frac{c_3 \alpha}{\beta} + \underline{\frac{c_1 \beta h^2+2 c_2 \alpha h}{2\beta(\beta x - \alpha)} + \frac{c_3(\beta x-\alpha)}{\beta}}.$

Hence, to minimize $c(x)$ is to find the $x$ that minimizes $\frac{c_1\beta h^2+2 c_2\alpha h }{2\beta(\beta x - \alpha)} + \frac{c_3(\beta x - \alpha)}{\beta}.$

Since $\frac{c_1\beta h^2+2 c_2\alpha h }{2\beta(\beta x - \alpha)} \cdot \frac{c_3(\beta x - \alpha)}{\beta}=\frac{(c_1 \beta h^2+2 c_2 \alpha h)c_3}{2\beta^2}$, a constant, by the following theorem:

For positive quantities $a_1, a_2, ..., a_n, c_1, c_2, ..., c_n$ and positive rational quantities $p_1, p_2, ..., p_n$, if $a_1^{p_1}a_2^{p_2}...a_k^{p_k}$ is a constant, then $c_1a_1+c_2a_2+...+c_na_n$ attains its minimum if $\frac{c_1a_1}{p_1} = \frac{c_2a_2}{p_2} = ... = \frac{c_na_n}{p_n}.$

(see “Solving Kepler’s Wine Barrel Problem without Calculus“), we solve equation

$\frac{c_1\beta h^2+2 c_2\alpha h }{2\beta(\beta x - \alpha)} = \frac{c_3(\beta x - \alpha)}{\beta}$

for $x$:

Fig. 2

From Fig. 2, we see that $x =\frac{\alpha}{\beta} - \frac{\sqrt{\beta c_1 c_3 h^2+2\alpha c_2 c_3 h}}{\sqrt{2}\beta c_3} \implies \beta x - \alpha < 0$, contradicts (2).

However, when $x =\frac{\sqrt{\beta c_1 c_3 h^2+2\alpha c_2 c_3 h}}{\sqrt{2}\beta c_3} + \frac{\alpha}{\beta}=\sqrt{\frac{\beta c_1 h^2 + 2 \alpha c_2 h}{2\beta^2 c_3}} + \frac{\alpha}{\beta}, \beta x-\alpha$ is a positive quantity. Therefore, it is

$x \overset{h=\alpha t_1}{=} \alpha \sqrt{\frac{\beta c_1 t_1^2 + 2 c_2 t_1}{2\beta^2 c_3}} + \frac{\alpha}{\beta}$

that minimizes the total cost.

# Seeing Finite Difference Approximations of the Derivatives

Consider function $f$ that has first and second derivatives at each point.

There are two finite difference approximations to its derivatives at a particular point $x$:

[1] $\frac{d}{dx}f(x) \approx \frac{ f(x+\frac{h}{2})-f(x-\frac{h}{2})}{h}$

Fig. 1

Intuitively (see Fig. 1),

$\frac{d}{dx} f(x) \approx \frac{ f(x+\frac{h}{2})-f(x-\frac{h}{h})}{h}\quad\quad\quad(1)$

[2] $\frac{d^2}{dx}f(x) \approx \frac{f(x+h)-2f(x)+f(x-h)}{h^2}$

Let

$g(x) = \frac{d}{dx}f(x) \overset{(1)}{\approx} \frac{f(x+\frac{h}{2})-f(x-\frac{h}{2})}{h}\quad\quad\quad(2)$

so that

$\frac{d^2}{dx}f(x) = \frac{d}{dx}(\frac{d}{dx}f(x))=\frac{d}{dx}(g(x)) \overset{(1)}{\approx} \frac{g(x+\frac{h}{2})-g(x-\frac{h}{2})}{h}.\quad\quad\quad(3)$

Substituting

$g(x+\frac{h}{2}) \overset{(2)}{=} \frac{f((x+\frac{h}{2})+\frac{h}{2})-f((x+\frac{h}{2})-\frac{h}{2})}{h}=\frac{f(x+h)-f(x)}{h}$

and

$g(x-\frac{h}{2}) \overset{(2)}{=} \frac{f((x-\frac{h}{2})+\frac{h}{2})-f((x-\frac{h}{2})-\frac{h}{2})}{h}=\frac{f(x)-f(x-h)}{h}$

into (3) gives

$\frac{d^2}{dx}f(x) \approx \frac{\frac{f(x+h)-f(x)}{h}-\frac{f(x)-f(x-h)}{h}}{h}=\frac{f(x+h)-f(x)-f(x)+f(x-h)}{h^2}=\frac{f(x+h)-2f(x)+f(x-h)}{h^2}.$

i.e.,

$\frac{d^2}{dx}f(x) \approx \frac{f(x+h)-2f(x)+f(x-h)}{h^2}.$

# A Not So Sinful Delight

Problem:

Show that if $x+\frac{1}{x}=1$ then $x^7+\frac{1}{x^7}=1.$

Solution-1:

From

$x+\frac{1}{x} = 1,\quad\quad\quad(0)$

we have

$x^2+1=x\quad\quad\quad(1)$

$\implies x^2=x-1\quad\quad\quad(2)$

$\implies x^3=x^2-x\overset{(2)}{=}(x-1)-x=-1\quad\quad\quad(3)$

$\implies x^6=1\quad\quad\quad(4)$

$\implies x^7=x\quad\quad\quad(5)$

$\implies x^7+\frac{1}{x^7}\overset{(5)}{=}x+\frac{1}{x}\overset{(0)}{=}1.$

Solution-2:

Exercise-1 Given $x^3+4x=8$, determine the value of $x^7+64x^2.$

# Algebra, CAS vs Human

Problem:

Given $x^3+4x=8$, determine the value of $x^7+64x^2$.

Solution-1 (CAS)

Solution-2 (Human)

From

$x^3+4x=8,\quad\quad\quad(1)$

we have

$(x^3+4x)^2=8^2$

$\implies x^6+8x^4+16x^2=64$

$\implies x^7+8x^5+16x^3=64x$

$\implies x^7+8x^5+16x^3+16x^3=64x +16x^3$

$\implies x^7+8x^5+32x^3=64x+16x^3$

$\implies x^7+8x^2(x^3+4x) =16(x^3+4x)$

$\overset{(1)}{\implies} x^7+8x^2\cdot 8 = 16\cdot 8$

$\implies x^7+64x^2=128$

Exercise-1 Show that if $x+\frac{1}{x} =1$ then $x^7+\frac{1}{x^7}=1.$

# That first sip of coffee in the morning

It is a good idea to enjoy a cup of coffee before starting a busy day.

Suppose the coffee fresh out of the pot with temperature $\alpha^{\circ} C$ is too hot, we can immediately add cream to reduce the temperature by $\delta^{\circ} C$ instantly, then wait for the coffee to cool down naturally to $\omega^{\circ} C$ before sipping it comfortably. We can also wait until the temperature of the coffee drops to $(\omega+\delta)^{\circ} C$ first, then add the cream to further reduce it instantly to $\omega^{\circ} C$.

Typically, $\alpha = 90, \omega = 75$, and $\delta = 5$.

If we are in a hurry and want to wait the shortest possible time, should the cream be added right after the coffee is made, or should we wait for a while before adding the cream?

The heat flow from the hot water to the surrounding air obeys Newton’s cooling and heating law, described by the following ordinary differential equation:

$\frac{d}{dt}\theta(t) = k (E-\theta(t))$

where $\theta(t)$, a function of time $t$, is the temperature of the water, $E$ is the temperature of its surroundings, and $k>0$ is a constant depends on the heat transfer mechanism, the contact are with the surroundings, and the thermal properties of the water.

Fig. 1 a place where Newton’s law breaks down

Under normal circumstances, we have

$E \ll \omega < \omega+\delta < \alpha-\delta < \alpha\quad\quad\quad(1)$

Based on Newton’s law, the mathematical model of coffee cooling is:

$\begin{cases} \frac{d}{dt}\theta(t) = k (E-\theta(t)) \\ \theta(0)= \theta_0\end{cases}\quad\quad\quad(2)$

Fig. 2

Solving (2), an initial-value problem (see Fig. 2) gives

$\theta(t) = E + e^{-kt}(\theta_0 - E).$

Therefore,

$t = \frac{\log\left(\frac{E-\theta_0}{E-\theta(t)}\right)}{k}=\frac{\log\left(\frac{\theta_0-E}{\theta(t)-E}\right)}{k}.\quad\quad\quad(3)$

If cream is added immediately (see Fig. 3),

Fig. 3 : cream first

by (3),

$t_1=\frac{\log\left(\frac{(\alpha-\delta)-E}{\omega-E}\right)}{k}.$

Otherwise (see Fig. 4),

Fig. 4: cream last

$t_2=\frac{\log\left(\frac{\alpha-E}{(\omega+\delta)-E}\right)}{k}.$

And so,

$t_1-t_2 = \frac{\log\left(\frac{(\alpha-\delta)-E}{\omega-E}\right)}{k}- \frac{\log\left(\frac{\alpha-E}{(\omega+\delta)-E}\right)}{k}=\frac{1}{k}\left(\log\left(\frac{(\alpha-\delta)-E}{\omega-E}\right)-\log\left(\frac{\alpha-E}{(\omega+\delta)-E}\right)\right)\quad(4)$

Fig. 5

Since

$\frac{(\alpha-\delta)-E}{\omega-E}- \frac{\alpha-E}{(\omega+\delta)-E}=\frac{(\alpha-\delta-E)(\omega+\delta-E)-(\omega-E)(\alpha-E)}{(\omega-E)(\omega+\delta-E)}=\frac{-\delta(\omega+\delta-\alpha)}{(\omega-E)(\omega+\delta-E)}\overset{(1)}{>0}$

implies

$\log\left(\frac{(\alpha-\delta)-E}{\omega-E}\right)-\log\left(\frac{\alpha-E}{(\omega+\delta)-E}\right)>0,\quad\quad\quad(5)$

from (4) , we see that

$t_1-t_2 > 0;$

i.e.,

$t_1 > t_2$

Hence,

If we are in a hurry and want to wait the shortest possible time, we should wait for a while before adding the cream!

Exercise-1 Solve (2) without using a CAS.

Exercise-2 Show that $\frac{\alpha-\delta-E}{\omega-E}\cdot\frac{\omega+\delta-E}{\alpha-E} >1.$

# An ODE to Thanksgiving

A turkey is taken from the refrigerator at ${\theta_0}^{\circ} C$ and placed in an oven preheated to $E^{\circ} C$ and kept at that temperature; after $t_1$ minutes the internal temperature of the turkey has risen to ${\theta_1}^{\circ} C$. The fowl is ready to be taken out when its internal temperature reaches ${\theta_2}^{\circ} C$.

Typically, ${\theta_0} = 2, E=200, t_1=30, \theta_1=16, \theta_2=88$.

Determine the cooking time required.

According to Newton’s law of heating and cooling (see “Convective heat transfer“), the rate of heat gain or loss of an object is directly proportional to the difference in the temperatures between the object and its surroundings. This law is best described by the following ODE (Ordinary Differential Equation):

$\frac{d}{dt}{\theta(t)} = k\cdot(E-\theta(t)),\quad\quad\quad(1)$

where $\theta(t), E$ are the temperatures of the object and its surroundings respectively. $k > 0$ is the constant of proportionality.

Fig. 1

We see that (1) has a critical point $\theta^* = E$. Fig. 1 illustrates the fact that depending on its initial temperature, an object either heats up or cools down, trending towards $E$ in both cases.

We formulate the problem as a system of differential-algebraic equations:

$\begin{cases} \frac{d}{dt}{\theta(t)} = k\cdot(E-\theta(t)) \\ \theta(0)=\theta_0\\ \theta(t_1)=\theta_1 \\ \theta(\boxed{t_2}) = \theta_2\end{cases}(2)$

To find the required cooking time, we solve (2) for $t_2$ (see Fig. 2).

Fig. 2

Using Omega CAS Explorer, the typical cooking time is found to be approximately $4$ hours ($3.88...\approx 4$)

Luise Lange of Woodrow Wilson Junior College once wrote (see ” A Century of Calculus, Part I”, p. 50):

“In many calculus texts problems are formulated too one-sidedly in terms of particular, numerical data rather than in general terms. While pedagogically it may be wise to begin a new type of problem with some numerical examples, it is only the general formulation, and the interpretation of the answer in general terms, which can give insight into the functional relation between the given and the derived data.”

I agree with her wholeheartedly! On encountering a mathematical modeling problem stated with numerical values, I prefer to re-state it using symbols first. Then solve the problem symbolically. The numerical values are substituted for the symbols at the very end.

This post is a case in point, as the problem is re-formulated from page 1005 of Jan Gullberg’s “Mathematics From the Birth of Numbers”:

Exercise-1 Solving (2) without using a CAS.

Exercise-2 Given $\theta_0< \theta_1 < E$, show that

$k = \frac{t\log(\frac{E-\theta_0}{E-\theta_1})}{t_1} > 0.$

Exercise-3 Given $\theta_0 < \theta_1< E$, verify that $\lim\limits_{t\rightarrow \infty} \theta(t) = E$ from

$\theta(t) = -Ee^{ -\frac{t\log(\frac{E-\theta_0}{E-\theta_1})}{t_1} } + \theta_0 e^{-\frac{t\log(\frac{E-\theta_0}{E-\theta_1})}{t_1}} + E.$

Exercise-4 A slice is cut from a loaf of bread fresh from the oven at $180^{\circ} C$ and placed in a room with a constant temperature of $20^{\circ} C$. After 1 minute, the temperature of the slice is $140^{\circ} C$. When has the slice of bread cooled to $32^{\circ} C$?

# Eye Of The Tiger

Evaluate

$\int \frac{x^2e^x}{(x+2)^2}\;dx$

is an exercise accompanied my previous post “Integration by Parts Done Right“. It is a special case of

$\int \frac{x^2e^x}{(x+\boxed{a})^2}\;dx$.

For various $a$, Omega CAS Explorer gives

$\int \frac{x^2}{(x+a)^2}e^x\;dx$

$= \int \left(\frac{x}{x+a}\right)^2 e^x\;dx$

$= \int \left(\frac{x+a-a}{x+a}\right)^2 e^x\;dx$

$=\int \frac{(x+a)^2-2a(x+a)+a^2}{(x+a)^2}e^x\;dx$

$= \int \left(1-\frac{2a}{x+a}+\frac{a^2}{(x+a)^2}\right)e^x\;dx$

$= \int e^x-\frac{2a}{x+a}e^x + \frac{a^2}{(x+a)^2}e^x\;dx$

$= \int e^x\;dx-\int \frac{2a}{x+a}e^x\;dx + \int \frac{a^2}{(x+a)^2}e^x\;dx$

$= e^x-2a\int \frac{e^x}{x+a}\;dx + \int \frac{a^2}{(x+a)^2}e^x\;dx$

$= e^x-2a\int \frac{1}{x+a}(e^x)'\;dx + \int \frac{a^2}{(x+a)^2}e^x\;dx$

$= e^x-2a\left(\frac{1}{x+a}e^x-\int (\frac{1}{x+a})' e^x\;dx\right) + \int \frac{a^2}{(x+a)^2}e^x\;dx$

$= e^x-2a\left(\frac{1}{x+a}e^x-\int\frac{-1}{(x+a)^2}e^x\;dx\right)+ \int \frac{a^2}{(x+a)^2}e^x\;dx$

$= e^x-2a\left(\frac{1}{x+a}e^x+\int\frac{1}{(x+a)^2}e^x\;dx\right)+ \int \frac{a^2}{(x+a)^2}e^x\;dx$

$= e^x-\frac{2a}{x+a}e^x-2a\int\frac{e^x}{(x+a)^2}\;dx + a^2\int \frac{e^x}{(x+a)^2}\;dx$

$= e^x-\frac{2a}{x+a}e^x-\left(2a-a^2\right)\int\frac{1}{(x+a)^2}e^x\;dx$

$\overset{2a-a^2=0}{=} \frac{x-a}{x+a}e^x$

$= \begin{cases} e^x, a=0\\ \frac{x-2}{x+2}e^x, a=2\end{cases}$

# Integration by Parts Done Right

Integration by parts is a technique for evaluating indefinite integral whose integrand is a product of two functions. It is based on the fact that

If two functions $u(x), v(x)$ are differentiable on an interval $I$ and $\int u(x)v'(x)\;dx$ exists, then

$\int u'(x) v(x)\;dx = u(x)\cdot v(x)-\int u(x)\cdot v'(x)\;dx\quad\quad\quad(1)$

It is not difficult to see that (1) is true:

Provide $\int u(x)\cdot v(x)'\;dx$ exist, let

$u = u(x), v = v(x)$

and

$R = u\cdot v - \int u\cdot v'\; dx$.

By the rules of differentiation (see “Some rules of differentiation”),

$R' = (u\cdot v)' - (\int u \cdot v'\;dx)'= u'\cdot v +u\cdot v' - u\cdot v' = u'\cdot v$.

i.e.,

$R = \int u'\cdot v\;dx$

or,

$\int u'\cdot v\;dx= u\cdot v - \int u\cdot v'\;dx$

The key to apply this technique successfully is to choose proper $u, v$ so that the integrand in the original integral can be expressed as $u'\cdot v$ and, $\int u\cdot v'\;dx$ is easier to evaluate than $\int u'\cdot v\;dx$.

To evaluate $\int \log(x)\;dx$, we let $u = x, v=\log(x)$ to get

$\int \log(x)\;dx = \int 1\cdot \log(x)\;dx$

$= \int (x)' \cdot \log(x) \;dx$

$= x\cdot\log(x) - \int x\cdot (\log(x))'\;dx$

$= x\log(x) - \int x \cdot \frac{1}{x}\;dx$

$= x\log(x) - \int 1\;dx$

$= x\log(x) -x$

In fact, for $n \ge 0$,

$\int x^n \log(x)\;dx = \int (\frac{x^{n+1}}{n+1})'\log(x)\;dx$

$= \frac{x^{n+1}}{n+1}\log(x)-\int \frac{x^{n+1}}{n+1}(\log(x))'\;dx$

$= \frac{x^{n+1}}{n+1}\log(x)-\int\frac{x^{n+1}}{n+1}\cdot \frac{1}{x}\;dx$

$= \frac{x^{n+1}}{n+1}\log(x)-\frac{1}{n+1}\int x^n\;dx$

$= \frac{x^{n+1}}{n+1}\log(x)-\frac{x^{n+1}}{(n+1)^2}$.

The following example of integrating a rather ordinary-looking expression offers unexpected difficulties and surprises:

$\int \sqrt{1-x^2}\;dx= \int x' \sqrt{1-x^2}\;dx$

$= x\sqrt{1-x^2}-\int x(\sqrt{1-x^2})'\;dx$

$= x\sqrt{1-x^2}- \int x\cdot \frac{1}{2}\cdot\frac{-2x}{\sqrt{1-x^2}}\;dx$

$= x\sqrt{1-x^2} +\int \frac{x^2}{\sqrt{1-x^2}}\;dx$

$= x\sqrt{1-x^2} + \int \frac{1-1+x^2}{\sqrt{1-x^2}}\;dx$

$= x\sqrt{1-x^2} + \int \frac{1}{\sqrt{1-x^2}}\;dx -\int \frac{1-x^2}{\sqrt{1-x^2}}\;dx$

$\overset{\frac{1-x^2}{\sqrt{1-x^2}}=\sqrt{1-x^2}}{= }x\sqrt{1-x^2}+\arcsin(x) - \boxed{\int\sqrt{1-x^2}\;dx}$

Notice the original integral (boxed) appears on the right of the “=” sign. However, this is not an indication that we have reached a dead end. To the contrary, after it is combined with the left side, we have

$2\int\sqrt{1-x^2}\;dx = x\sqrt{1-x^2} + \arcsin(x)$

and so,

$\int \sqrt{1-x^2}\;dx = \frac{1}{2}(x\sqrt{1-x^2} + \arcsin(x))$

Sometimes, successive integration by parts is required to complete the integration. For example,

$\int e^x \cos(x)\;dx = \int (e^x)' \cos(x)\;dx$

$= e^x \cos(x)-\int e^x (\cos(x)' \; dx$

$= e^x \cos(x) +\int e^x \sin(x)\; dx$

$= e^x\cos(x)+\int (e^x)' \sin(x)\;dx$

$= e^x \cos(x) + (e^x \sin(x)-\int e^x (\sin(x))' \;dx)$

$=e^x \cos(x) + e^x \sin(x) - \boxed{\int e^x \cos(x)\;dx}$.

Hence,

$2\int e^x\cos(x)\;dx = e^x\cos(x) + e^x\sin(x)$

i.e.,

$\int e^x\cos(x)\;dx = \frac{e^x}{2}(\cos(x)+\sin(x))$

Exercise-1 Evaluate

1) $\int \log^2(x)\;dx$

2) $\int x\log(\frac{1-x}{1+x})\;dx$

3) $\int \log(x+\sqrt{1+x^2})\; dx$

While Maxima choked:

Mathematica came through:

4) $\int \frac{x}{\sqrt{1+2x}}\;dx$

5) $\int x\cdot \arctan(x)\;dx$

6) $\int \frac{x^2}{(1+x^2)^2}\;dx$

7) $\int \frac{x^2\cdot e^x}{(x+2)^2}\;dx$

Both Maxima and Mathematica came though:

# In the spirit of Archimedes’ method of exhaustion

Shown in Fig. 1 is a pile of $n$ cylinders that approximates one half of a sphere.

Fig. 1

From Fig. 1, we see $r_i^2 = r^2-h_i^2$.

If $\Delta V_i$ denotes the volume of $i^{th}$ cylinder in the pile, then

$\Delta V_i = \pi \cdot r_i^2 \cdot \frac{r}{n}$

$= \pi (r^2-h_i^2) \cdot \frac{r}{n}$

$= \pi (r^2-(i\cdot\frac{r}{n})^2)\cdot \frac{r}{n}$

$= \frac{\pi r^3}{n} (1-(\frac{i}{n})^2)$.

Let

$V_{*}=\sum\limits_{i=1}^{n}\Delta V_i$,

we have

$V_{*}= \sum\limits_{i=1}^{n}\frac{\pi r^3}{n} (1-(\frac{i}{n})^2)$

$= \frac{\pi r^3}{n}\sum\limits_{i=1}^{n}(1-(\frac{i}{n})^2)$

$= \frac{\pi r^3}{n}(\sum\limits_{i=1}^{n}1-\sum\limits_{i=1}^{n}(\frac{i}{n})^2)$

$= \frac{\pi r^3}{n}(n-\frac{1}{n^2}\sum\limits_{i=1}^{n}i^2)$

$= \frac{\pi r^3}{n}(n-\frac{n(n+1)(2n+1)}{6n^2})\quad\quad\quad($see “Little Bird and a Recursive Generator$)$

$= \pi r^3(1-\frac{(n+1)(2n+1)}{6n^2})$

$= \pi r^3(1-\frac{2n^2+3n+1}{6n^2})$

$= \pi r^3(1-\frac{2+\frac{3}{n}+\frac{1}{n^2}}{6})$.

As $n \rightarrow \infty,$

$V_* \rightarrow \pi r^3 (1-\frac{1}{3}) = \frac{2}{3}\pi r^3=V_{\frac{1}{2}sphere}.$

Therefore, $V_{sphere}= 2\cdot V_{\frac{1}{2}sphere}$ gives

$V_{sphere} = \frac{4}{3}\pi r^3\quad\quad\quad(1-1)$

Similarly, we approximate a cone

by a stack of $n$ cylinders:

Fig. 2

Since

$h_i = i\cdot\frac{h}{n}\quad\quad\quad(2-1)$

and

$\frac{h_i}{h} = \frac{r_i}{r}$,

we have

$r_i = \frac{r\cdot h_i}{h}\overset{(2-1)}{=}\frac{r}{h}\cdot i\frac{h}{n}=\frac{r\cdot i}{n}.\quad\quad\quad(2-2)$

If $\Delta V_i$ denotes the $i^{th}$ cylinder, then

$\Delta V_i = \pi\cdot r_i^2\cdot\frac{h}{n}\overset{(2-2)}{=}\frac{\pi r^2 i^2 h}{n^3}$.

Let

$V_* = \sum\limits_{i=1}^{n}\Delta V_i,$

we have

$V_*= \frac{\pi r^2 h}{n^3}\sum\limits_{i=1}^{n} i^2$

$= \frac{\pi r h}{n^3} \cdot \frac{2n^3+3n^2+n}{6}$

$= \pi r^2 h (\frac{1}{3} + \frac{1}{2n} + \frac{1}{6n^2})$.

Since as $n \rightarrow \infty$, $V_*\rightarrow \frac{1}{3}\pi r^2 h$, we have

$V_{cone} = \frac{1}{3}\pi r^2 h.\quad\quad\quad(2-3)$

We now derive the formula for a sphere’s surface area.

Let us approximate a sphere by many cones:

Fig. 3

From Fig. 3, we see that as $\Delta A_i \rightarrow 0$,

$h \rightarrow r, \;\sum\limits_{i}\Delta A_i \rightarrow A_{sphere}$.

Consequently,

$\sum\limits_{i} \Delta V_i \overset{(2-3)}{=} \sum\limits_{i} \frac{1}{3}\Delta A_i h = \frac{1}{3}h \sum\limits_{i}\Delta A_i \rightarrow \frac{1}{3}rA_{sphere}$

and,

$\sum\limits_{i} \Delta V_i \rightarrow V_{sphere} \overset{(1-1)}{=} \frac{4}{3}\pi r^3$.

It follows that

$\frac{1}{3}r A_{sphere} = \frac{4}{3}\pi r^3.$

Hence,

$A_{sphere} = 4 \pi r^2.$