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!**