A Mathematical Allegory

We have defined function \arcsin as a set:

\{(x, y) | \sin(y) =x, \frac{-\pi}{2} \le y \le \frac{\pi}{2}\}.

By definition,

\arcsin(-1) = \frac{-\pi}{2}, \arcsin(0)=0, \arcsin(1) = \frac{\pi}{2}


\frac{d}{dx} \arcsin(x) = \frac{1}{\sqrt{1-x^2}}.

It means that \arcsin(x) is the unique solution of

\frac{dy}{dx} = \frac{1}{\sqrt{1-x^2}}\quad\quad\quad(\star)

where y(-1)=-\frac{\pi}{2}, y(0)=0 and y(1)=\frac{\pi}{2}.

To compute \arcsin(x), we solve (\star) for y(x) as follows:

Integrate \frac{dy}{dx} = \frac{1}{\sqrt{1-x^2}} from -1 to x gives

\displaystyle\int\limits_{-1}^{x}\frac{dy}{dx} \,dx=\displaystyle\int\limits_{-1}^{x}\frac{1}{\sqrt{1-\xi^2}}\; d\xi\overset{\textbf{FTC}}{\implies}y(x) - y(-1) = \displaystyle\int\limits_{-1}^{x} \frac{1}{\sqrt{1-\xi^2}}\, d\xi.


y(x) = \displaystyle\int\limits_{-1}^{x}\frac{1}{\sqrt(1-\xi^2}\,d\xi + y(-1) \overset{y(-1)=\frac{-\pi}{2}}{=} \displaystyle\int\limits_{-1}^{x}\frac{1}{\sqrt{1-\xi^2}}\,d\xi - \frac{\pi}{2}.

That is,

\arcsin(x) = \displaystyle\int\limits_{-1}^{x} \frac{1}{\sqrt{1-\xi^2}}\;d\xi - \frac{\pi}{2}.

To obtain \arcsin(x), -1 < x < 1, we numerically evaluate \int\limits_{-1}^{x}\frac{1}{\sqrt{1-\xi^2}}\,d\xi, using function ‘quad_qags’.

Fig. 1

The result is visually validated in Fig. 2.

Fig. 2

Note: ‘romberg’, another function that computes the numerical integration by Romberg’s method will not work since it evaluates \frac{1}{\sqrt{1-x^2}} at x=-1.

Fig. 3

An alternate approach is to solve \frac{dy}{dx} = \frac{1}{\sqrt{1-x^2}}, y(0)=0 as an initial-value problem of ODE using ‘rk’ , the function that implements the classic Runge-Kutta algorithm.

Fig. 4 for 0 < x < 1

Fig. 5 -1<x<0

Putting the results together, we have

Fig. 6 -1<x<1

However, we cannot solve \frac{dy}{dx} = \frac{1}{\sqrt{1-x^2}}, y(-1)=\frac{-\pi}{2} using ‘rk’:

Fig. 7

Exercise-1 Compute \arccos(x) for x \in (-1, 1).

Exercise-2 Explain why ‘rk’ cannot solve \frac{dy}{dx} = \frac{1}{\sqrt{1-x^2}}, y(-1)=\frac{-\pi}{2}.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s