# Consider the function defined by f(x)= sinx/x if -1 <=x < 0, ax+b if 0 < =x <= 1 and (1-cosx)/x if x >1, how do you determine a and b such that f(x) is continuous on [-1,2]?

Jun 24, 2017

$a = - \cos 1 \approx = 0.540$
$b = 1$

#### Explanation:

Assuming we are working in radians.

We want our function, $f \left(x\right)$ to be defined by:

$f \left(x\right) = \left\{\begin{matrix}\sin \frac{x}{x} & - 1 \le x < 0 \\ a x + b & 0 < x \le 1 \\ \frac{1 - \cos x}{x} & x > 1\end{matrix}\right.$

Let us denote each sub-function by ${f}_{1} \left(x\right) , {f}_{2} \left(x\right)$ and ${f}_{3} \left(x\right)$ such that:

$f \left(x\right) = \left\{\begin{matrix}{f}_{1} \left(x\right) = \sin \frac{x}{x} & - 1 \le x < 0 \\ {f}_{2} \left(x\right) = a x + b & 0 < x \le 1 \\ {f}_{3} \left(x\right) = \frac{1 - \cos x}{x} & x > 1\end{matrix}\right.$

We can graph for illustrative purposes, ${f}_{1} \left(x\right)$ and ${f}_{3} \left(x\right)$ for the domain $x \in \mathbb{R}$

And we note that all three sub-functions are continuous in their own right.

If we now examine the functions ${f}_{1} \left(x\right)$ and ${f}_{1} \left(x\right)$ restricted to their appropriate domains we have:

So, as we expected there is a discontinuity at the junctions between ${f}_{1} \left(x\right)$ and ${f}_{2} \left(x\right)$ and between ${f}_{2} \left(x\right)$ and ${f}_{3} \left(x\right)$ so as we require a linear function $a x + b$ to complete the continuity we simply need to find the two coordinates associated with the discontinuity and find the unique equation of the straight line that [passes through those point.

Using some standard calculus trigonometry limits we have:

When $x = 0 \implies {f}_{1} \left(x\right) = {\lim}_{x \rightarrow 0} \sin \frac{x}{x} = 1$
When $x = 1 \implies {f}_{3} \left(x\right) = {\lim}_{x \rightarrow 0} \frac{1 - \cos x}{x} = 1 - \cos 1$

So the coordinates of the discontinuities are:

$\left(0 , 1\right)$ and $\left(1 , 1 - \cos 1\right)$

So using the straight line point/point equation:

$\frac{y - {y}_{1}}{{y}_{2} - {y}_{1}} = \frac{x - {x}_{1}}{{x}_{2} - {x}_{1}}$

then the equation we seek is:

$\frac{y - 1}{1 - \cos 1 - 1} = \frac{x - 0}{1 - 0}$

$\therefore \frac{y - 1}{- \cos 1} = x$
$\therefore y - 1 = - x \cos 1$
$\therefore y = - x \cos 1 + 1$

Thus comparing $y = - x \cos 1 + 1$ with y=ax+b# we require:

$a = - \cos 1 \approx = 0.540$
$b = 1$