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

## Finding Derivatives with Limits

At this point we should have at least a basic understanding of limits and how to find some limits.  However, I have only really discussed limits by themselves and not how they relate to the rest of calculus.  They are very important in calculus because they are used to define the most important calculus topics.

For example, the main topic which will be discussed for quite some time is derivatives.  Derivatives will come up in a lot of different settings, like finding rate of change, instantaneous rate of change, velocity, slope, and a few others.  The main thing to realize is that a derivative is generally used to find out how quickly, or slowly, something is changing.

I will go further into all of these things later, but for now I want to focus on the definition of derivatives and how to find a derivative using the definition.

## The definition of a derivative

If we have some function, $$f(x)$$, we would write “the derivative of f” as $$f'(x)$$.  And we would define the derivative of f by using this limit:

$$f'(x) = \lim_{h \to 0} \frac{f(x+h) – f(x)}{h}$$

This limit can be a bit confusing, so there’s something I would like to point out before we actually begin working with this limit.  The confusing thing here is that we have $$x$$ and $$h$$ in this limit and it looks as if they are both variables.  However, when we find this limit, we can only treat $$h$$ as a variable.  We will need to treat x as a constant and h as the only variable.

The reason for this is that we are finding the limit as $$h$$ goes to $$0$$.  This tells us that $$h$$ is moving in toward $$0$$.  It does not tell us that $$x$$ is changing at all.  Therefore, when we are working with the limit, we will act as if $$x$$ is a number, or a constant.  This means that once we find the limit, our answer may have $$x$$ in it still and this is completely fine since $$x$$ isn’t the variable in this case.  Now let’s try an example.

## Example 1

Consider the function $$f(x) = 4x^2 – 7x + 12$$.  We will use the limit definition to find the derivative of this function, but first let’s break it down and consider each part on its own.

### Finding f(x+h)

The fist thing we need to find is $$f(x+h)$$.  This notation basically just means that we need to look at our function $$f$$, and plug in $$(x+h)$$ wherever we see the input.  In other words, we need to replace all of the $$x$$’s in the function with $$(x+h)$$’s.  So,

$$f(x+h) = 4(x+h)^2 – 7(x+h) + 12.$$

Then we will want to expand this out so it’s easier to work with.  Remember $$(x+h)^2$$ is the same as $$(x+h)(x+h)$$, which means we need to foil it.

$$f(x+h) = 4(x+h)(x+h) – 7(x+h) + 12$$

$$=4(x^2 + xh + xh + h^2) – 7(x+h) + 12$$

$$=4(x^2 + 2xh+ h^2) – 7(x+h) + 12$$

$$=4x^2 + 8xh+ 4h^2 – 7x – 7h + 12$$

Since there aren’t any like terms we will leave it at that for now.

### Putting it all together

Now we can put that into the rest of the equation.  Since we now know $$f(x+h)$$ and $$f(x)$$, we can plug those into the equation.  I would recommend surrounding each of them with a set of parenthesis so you don’t forget to distribute the negative sign in front of the $$f(x)$$.  This is a very common mistake, so be careful not to forget that because it will give you the wrong answer.

$$f'(x) = \lim_{h \to 0} \frac{f(x+h) – f(x)}{h}$$

$$= \lim_{h \to 0} \frac{(4x^2 + 8xh+ 4h^2 – 7x – 7h + 12) – (4x^2 – 7x + 12)}{h}$$

### Solving the limit

When I first see a limit, the first thing I usually consider is whether we can simply plug in $$0$$ for $$h$$. Essentially, I try to treat this function as if it were continuous at $$h=0$$ (remember $$h$$ is the variable here).

However, if we do this here we will get $$0$$ on the denominator.  Since you cannot divide by 0, this will not work.  So our strategy will be to simplify this fraction to a point where we can plug in $$0$$ for $$h$$.  The simplest way to do this is to rearrange the numerator so that we can cancel an $$h$$ from the numerator and denominator and get rid of our fraction all together.

$$f'(x)= \lim_{h \to 0} \frac{4x^2 + 8xh+ 4h^2 – 7x – 7h + 12 – 4x^2 + 7x – 12}{h}$$

$$= \lim_{h \to 0} \frac{8xh+ 4h^2 – 7h}{h}$$

At this point I would like to point something out. Notice, after simplifying the numerator of the fraction, each term remaining contains an $$h$$ in it.  This is important because it allows us to factor the $$h$$ out and cancel it with the $$h$$ in the denominator, getting rid of the fraction.  This will be an extremely common strategy to use for finding the derivative of a function using the limit definition.

$$f'(x)= \lim_{h \to 0} \frac{h(8x+ 4h – 7)}{h}$$

$$= \lim_{h \to 0} 8x+ 4h – 7$$

Now we have simplified to a point that we can solve this limit by plugging $$0$$ in for $$h$$.

$$f'(x)= 8x+ 4(0) – 7$$

$$= 8x – 7$$

So we have just shown that if $$f(x)=4x^2-7x+12$$, then $$f'(x)=8x-7$$.  We will later learn shortcuts like the product rule, quotient rule, and chain rule that will make finding derivatives like this much simpler and faster, but you will need to know how to find these using the limit definition.  The pattern shown in this problem is a common one.  It won’t work for all derivatives, but it’s a good thing to try first.

• It’s generally a good idea to see if you can reengage the top of the fraction in such a way that every term has $$h$$ as a factor.
• Then you can factor out the $$h$$, and cancel it with the $$h$$ on the bottom of the fraction.
• This usually leaves you with a function that you can directly plug $$0$$ into $$h$$ and simplify from there, leaving you with a function that doesn’t contain any $$h$$’s, but usually contains $$x$$’s.

Enter your email below and I’ll send you my calculus 1 study guide which is packed full of helpful tricks and shortcuts to help you boost your scores in calc!

I would recommend checking out the other material I have about derivatives.  As I mentioned before, there are several shortcuts and methods that make this whole process a lot easier.  Go check out what I’ve written about on the derivatives page.  If you have a question that isn’t answered there just let me know by emailing me at jakesmathlessons@gmail.com.  I’ll do my best to answer any questions you send me and I may even post a lesson or full solution on it!