## Solution – Find the values of a and b that make the function differentiable everywhere.

Find all values of $a$ and $b$ that make the following function differentiable for all values of $x$.

$$f(x) = \begin{cases} bx^2-3 & \mbox{if } x\leq -1 \\ ax+b & \mbox{if } x>-1 \end{cases}$$

When trying to solve a problem like this, there are actually two things you will need to consider for our function $f(x)$.  Obviously, we need to make sure that it’s differentiable everywhere, but this actually implies something else that we will want to consider as well.

Since a function being differentiable implies that it is also continuous, we also want to show that it is continuous.  The reason for this is that any function that is not continuous everywhere cannot be differentiable everywhere.  Once we make sure it’s continuous, then we can worry about whether it’s also differentiable.

## Making sure f(x) is continuous everywhere

I’m not going to go into quite as much detail to show the part about making sure the function is continuous because I have already done this, which you can see by clicking here.

To make sure $f(x)$ is continuous at $x=-1$ we need to make sure that $$\lim_{x \to -1} f(x) = f(-1).$$  Since we have a piecewise function, we will need to consider each one-sided limit, but in this case only the right sided limit will tell us something useful.

$$\lim_{x \to -1^{+}} f(x) = f(-1)$$

$$\lim_{x \to -1^{+}} ax+b = b(-1)^2-3$$

$$a(-1)+b=b-3$$

$$-a+b=b-3$$

$$-a=-3$$

$$a=3$$

So now we know that $f(x)$ will be continuous everywhere as long as $a=3$.  However, this doesn’t really tell us that $f(x)$ is differentiable everywhere as well.

## Making sure f(x) is differentiable everywhere

We now know that we will need to let $a=3$ in order for this function to be continuous and to have a chance of being differentiable.  As a result, we can say that we are now trying to make this function differentiable everywhere:

$$f(x) = \begin{cases} bx^2-3 & \mbox{if } x\leq -1 \\ 3x+b & \mbox{if } x>-1 \end{cases}$$

We can see that the only place this function would possibly not be differentiable would be at $x=-1$.  The reason for this is that each function that makes up this piecewise function is a polynomial and is therefore continuous and differentiable on its entire domain.  The only place we may have a problem is when we have to switch between the two functions.

#### What does it mean for a function to be differentiable?

It means that its derivative exists for all values of $x$.  In other words, we need to be able to find its derivative no matter what $x$ is.

However, as I mentioned above, in this case we really only need to make sure that we can find the derivative of $f(x)$ when $x=-1$ since we know it would exist for all other values of $x$.  By using the definition of a derivative, we need to make sure the following limit exists at $x=-1$.

$$\lim_{h \to 0} \frac{f(x+h)-f(x)}{h}$$

Since we need to check this when $x=-1$, we can plug in $-1$ for $x$.  Therefore, we need to make sure this limit exists:

$$\lim_{h \to 0} \frac{f(-1+h)-f(-1)}{h}$$

I went over this limit definition in greater detail previously.  If you want a refresher on where this is coming from you can find that by clicking here.

Just like when we had to find the limit to make sure that $f(x)$ was continuous, we will need to consider each one sided limit separately in order to find this limit.  And also like when we checked for continuity, each one sided limit is going to require the use of a different section of our piecewise function.

#### Setting up the limits

When $h$ is slightly less than $0$, and we are considering the left sided limit, $f(-1+h)$ would need to be found using the $y=bx^2-3$ because this would involve inputting $x$ values which are less than $-1$.

By the same reasoning, when $h$ is slightly greater than $0$, and we are considering the right sided limit, $f(-1+h)$ would need to be found using the $y=3x+b$ because this would involve inputting $x$ values which are greater than $-1$.  Therefore, we need to consider the following one sided limits:

$$\lim_{h \to 0^{-}} \frac{\Big[b(-1+h)^{2}-3\Big]-\Big[b(-1)^{2}-3\Big]}{h}$$

$$\lim_{h \to 0^{+}} \frac{\Big[3(-1+h)+b\Big]-\Big[b(-1)^{2}-3\Big]}{h}$$

#### Now what do we do with these limits?

Now remember, as I discussed in the lesson about one-sided limits, in order for a limit to exist we need both of its one-sided limits to exist and they need to be equal.  Therefore, in order to show that the derivative of $f(x)$ exists at $x=-1$, these two one-sided limits need to be equal to each other.  Before setting them equal to each other, first we’ll simplify them a bit.  First the left side limit.

$$\lim_{h \to 0^{-}} \frac{\Big[b(-1+h)^{2}-3\Big]-\Big[b(-1)^{2}-3\Big]}{h}$$

$$=\lim_{h \to 0^{-}} \frac{\Big[b(-1+h)(-1+h)-3\Big]-\Big[b(1)-3\Big]}{h}$$

$$=\lim_{h \to 0^{-}} \frac{\Big[b(1-2h+h^2)-3\Big]-\Big[b-3\Big]}{h}$$

$$=\lim_{h \to 0^{-}} \frac{\Big[b-2bh+bh^2-3\Big]-\Big[b-3\Big]}{h}$$

$$=\lim_{h \to 0^{-}} \frac{b-2bh+bh^2-3-b+3}{h}$$

$$=\lim_{h \to 0^{-}} \frac{bh^2-2bh}{h}$$

$$=\lim_{h \to 0^{-}} \frac{h(bh-2b)}{h}$$

$$=\lim_{h \to 0^{-}} bh-2b$$

$$=-2b$$

And now the right sided limit.

$$=\lim_{h \to 0^{+}} \frac{\Big[3(-1+h)+b\Big]-\Big[b(-1)^{2}-3\Big]}{h}$$

$$=\lim_{h \to 0^{+}} \frac{\Big[-3+3h+b\Big]-\Big[b(1)-3\Big]}{h}$$

$$=\lim_{h \to 0^{+}} \frac{-3+3h+b-b+3}{h}$$

$$=\lim_{h \to 0^{+}} \frac{3h}{h}$$

$$=\lim_{h \to 0^{+}} 3$$

$$=3$$

Now if we set these two simplified versions of the one-sided limits equal to each other, we get

$$-2b=3$$

$$b=-\frac{3}{2}$$

#### What does this tell us?

So now if we put both pieces together, we know that $a=3$ will ensure that $f(x)$ is continuous and then making $b=-\frac{3}{2}$ will also make sure $f(x)$ is differentiable at $x=-1$.  This would in turn make $f(x)$ differentiable for all values of $x$, or make it differentiable everywhere.

As always, I want to hear your questions!  Go check out my other lessons about derivatives and if you can’t get your question answered, I’d love to hear from you.  Leave a comment below or email me at jakesmathlessons@gmail.com.  If you have questions on this problem and solution or if you have another question you would like to see me answer, just ask it.  Or if you have an entire topic you would like to see me write a lesson about, just let me know.

Enter your name and email below and I will also send you my calculus 1 study guide as a FREE bonus as a welcome gift!

## Continuity

Continuity is a relatively simple concept, but problems that require proving it can be a little tricky. Essentially, a continuous function is one that you can draw all in one motion without picking up your pencil. This is one explanation of what it means for a function to be continuous that I like because it doesn’t take any mathematical definitions or proofs to understand. Any holes or gaps in a function’s graph would be a discontinuity and would mean that the function is not continuous.

## The limit definition of continuity

By definition, a function $f(x)$ is continuous at $x=a$ if $$\lim_{x \to a} f(x) = f(a).$$

Let’s think about what this equation is saying. The left side of this equation is something that we’ve already dealt with, limits. It’s asking us to find out what $y$ value we close in on as we travel along our function and close in on $x=a$. Keep in mind, $x$ is a variable here which represents the input of our function, $f(x)$, and $a$ is a constant. This means that $a$ represents some specific number, which could be any number.

The right side of the equation is simply asking us to plug that same $a$ value into $f(x)$ and take the $y$ value we get out.

In total, the above equation says that if we travel along a function and close in on a specific $x$ value, we should close in on the same $y$ value we would get if we simply plugged that $x$ value into the equation.

In other words, as we travel along a function toward a specific $x$ value, our $y$ value will also go toward the $y$ value of the function at that point. If that is the case, then the function is continuous at that specific point. If we can say that a function is continuous at every single possible value we could put in for $a$, then we can say that the function is continuous for all $x$. If this is true then we can draw our entire function in one motion without picking up our pencil!

Let’s do a couple examples.

## Example 1

Remember back in the first lesson about limits, Limits – Intro, I said I would go back to discussing the importance of our limit in the first example giving us the same value as when we plugged $x=2$ into the equation?  I would like to go into that further.

The function we were considering was $f(x) = x^2$ and we were finding

$$\lim_{x \to 2} x^2.$$

After looking at the graph of this function, shown in Figure 1.1, we saw that

$$\lim_{x \to 2} x^2 = 4.$$

I also pointed out that plugging in $x=2$ directly into the function also returns a $y$ value of $4$. In other words, we know $$f(2) = 4.$$ Therefore, we know

$$\lim_{x \to 2} x^2 = 4 = f(2)$$

$$\lim_{x \to 2} x^2 = f(2).$$

Notice this is exactly like the definition of what it means for a function to be continuous at a point. If you replace $a$ with $2$, replace $f(x)$ with $x ^2$, and replace $f(a)$ with $4$, we have just shown that $y=x^2$ is a function that is continuous at $x=2.$

## Example 2

The next example I want to discuss also goes back to a function we have already looked at. Referring back to Limits – Intro we will consider $f(x)$ shown in Figure 1.2.

The question we will answer here is whether this function is continuous at $x=1$ or not. What do you think?

There are a few different ways we can answer this question. The simplest would be to simply look at the graph of the function and think about whether we can draw that function at and around $x=1$ without picking up our pencil. As you can see, there is clearly a hole at $x=1$ where we would need to pick up our pencil, and add a single point at $(1, \ 4)$.

As a result, it is probably safe to say that this function is not continuous at $x=1$. However, we want to be able to show this using the actual definition of what it means for a function to be continuous.

Remember, for this function, which we are calling $f(x)$ in this case, we need to be able to show that $$\lim_{x \to 1} f(x) = f(1).$$

If we can show this equation to be true, then $f(x)$ is continuous at $x=1$, and if it’s not true then the function is not continuous at $x=1$. Luckily, back when I first used this function as an example in the Limits – Intro lesson, we found that $$\lim_{x \to 1} f(x) = 2.$$ Therefore, we just need to find out if $f(1)$ is also $2$ and we can prove that this function is continuous or not continuous.

Looking at the graph again, we see that this function has a hole at $x=1$ and includes the point $(1, \ 4)$. In other words, if we plug $1$ into $f(x)$ as our $x$ value, we get a $y$ value of $4$ out. This is the same as saying $f(1) = 4$.

Now, at this point we have figured out $$\lim_{x \to 1} f(x) = 2 \ and$$ $$f(1) = 4.$$

Therefore, $$\lim_{x \to 1} f(x) \neq f(1)$$ and we can say that $f(x)$ is not continuous at $x=1$.

## More Examples

Find the values of $a$ and $b$ that make $f$ continuous everywhere.

$$f(x) = \begin{cases} \frac{x^2-4}{x-2} & \mbox{if } x<2 \\ ax^2-bx+3 & \mbox{if } 2\leq x<3 \\ 2x-a+b & \mbox{if } x\geq 3 \end{cases}$$