If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Limits of piecewise functions

In this video, we explore limits of piecewise functions using algebraic properties of limits and direct substitution. We learn that to find one-sided and two-sided limits, we need to consider the function definition for the specific interval we're approaching and substitute the value of x accordingly.

Want to join the conversation?

  • leaf blue style avatar for user Cochran
    What does piecewise mean?
    (9 votes)
    Default Khan Academy avatar avatar for user
  • leaf blue style avatar for user Akash
    At is it not possible that the square root of 4 is also equal to -2, such that the limit of f(x) as x approaches 4 from the right does not exist? Or is the negative square root rejected?
    (6 votes)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user Kelvin L.
      Hey there!

      For your question, the negative square root is not rejected. It is simply because the functions asks for the principal square root; that is, the positive value of the square root. For your example, the function asks for the sqrt(x). This is interpreted as the principal square root of x. If we plug in 4, the principle square root would be positive 2.

      For some additional context, if the function wanted both the positive and negative roots, we would write +/-sqrt(x), which if we plug in 4 would evaluate to both 2 and -2. Additionally, if we just want the negative roots, we could write -sqrt(x), which gives only -2 when we plug in 4.

      Hope this clears some confusion!
      (14 votes)
  • winston default style avatar for user Wenchuan
    Hi, I am always wondering: What is the limit of the f(x) you give, while x is approaching 0? or it does not exist?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user Chuck Finley
      One would use the appropriate one sided limit for such values at the endpoints of a domain. In this case the value approached by the function as x closes on 0 is, indeed, -2: lim x → 0+ = -2. However lim x → 0 does not exist because lim x → 0- does not exist as all values of x equal to or smaller than zero are not part of the domain of f(x).
      (13 votes)
  • aqualine ultimate style avatar for user Z
    What background knowledge do I need to have before starting calculus? It will be nice to know what I need to know so I could learn this as clearly as possible.
    (2 votes)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user kubleeka
      A calculus course will usually start from scratch with limits, so having previous experience with limits is helpful, but not strictly necessary.

      You should be very comfortable with algebra and algebraic manipulations. Most calculus problems consist of many lines of algebra, and just a little calculus at the beginning or end. You should also be familiar with the trigonometric functions and have some basic trig identities easily available, like the Pythagorean and double-angle identities.

      You'll need a grasp of series and sigma notation as well, and that should set you for Calculus 1 or AP Calculus AB.
      (14 votes)
  • leafers seedling style avatar for user alejoqxno2
    At , why when x tends to -1 isn't the result 1/2? -1 IS in the second interval which would give us 2^-1= 1/2. I get why the limit doesn't exist though. I just find it weird that the -1 belongs to the interval.
    (3 votes)
    Default Khan Academy avatar avatar for user
  • leaf orange style avatar for user curiousfermions
    For f(x), what will be the limit as x approaches 1?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • female robot grace style avatar for user loumast17
      Good question, the limit does not exist though. The easiest way to tell is to graph it, you will see there is a vertical asymptote, where it heads toward infinity from the right and negative infinity from the left.

      The only way a limit would exist is if there was something to "cancel out" the x-1 in the denominator. So if you had something like [(x+2)(x-1)]/(x-1). Then there would be a hole at 1, but the limit would still exist, and it would be 3. This is how you have to handle most rational functions.
      (2 votes)
  • leaf green style avatar for user Akshay Raman
    Sorry but can anyone give the intuition behind why anything to the power 0(a^0) is 1.
    ...also what about 0^0?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • cacteye blue style avatar for user Jerry Nilsson
      We know that increasing the exponent by 1 represents a multiplication by 𝑎 (the base):
      𝑎^(𝑛 + 1) = (𝑎^𝑛) ∙ 𝑎

      By the same logic, decreasing the exponent by 1 represents a division by 𝑎:
      𝑎^(𝑛 − 1) = (𝑎^𝑛)∕𝑎

      Thereby, we can write
      𝑎^0 = 𝑎^(1 − 1) = (𝑎^1)∕𝑎 = 𝑎∕𝑎 = 1, as long as 𝑎 ≠ 0 because otherwise we get 0∕0 which is an indeterminate expression.
      (3 votes)
  • piceratops ultimate style avatar for user Ricardo França
    At Sal writes sin(-1+1)=0 . Shouldn't he have written (...)= 0+Pi*k?
    Is there some rule that limits must have a single value?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user kubleeka
      There is a rule (and a theorem, not just a definition) that limits have at most one value, but it's not terribly relevant here. As the input of sin(x) approaches 0, sin(x) approaches 0 as well.

      It's true that sin(x) approaches 0 around other x-values as well, but that's irrelevant here, because we're only looking at sin(x) around x=0 (or at sin(x+1) around x=-1).
      (2 votes)
  • blobby green style avatar for user Jon Sumpter
    Before we leave tangent functions and limits... the graph of the tangent function at PI indicates the limit approaches -1. You are saying the limit approaches 0. Please advise the discrepancy.
    (1 vote)
    Default Khan Academy avatar avatar for user
  • duskpin ultimate style avatar for user Kellyzhixin Li
    I did an exercise on Khan Academy but I wasn't sure why. So the problem is the following:
    g(x):
    (first equation): (x/3)-2 for 0<x<6
    (second equation): cos(x∙π) for 6≤x≤10
    Then, it's asked to find the limit of g(x) when x is approaching 6.
    So what's the answer for this question and why?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • starky sapling style avatar for user Nightmare252
      This shows that when you graph the function g(x) from 0 to 6 the function would be (x/3)-2 and from 6 to 10 the function would be cos(x*pi).

      From the left side on the number line you can plug in 6 to the function:

      (6/3) - 2 gives you 0

      From the right side when you plug in 6 you get

      cos(6 pi) which is equal to 1

      Since the limit of g(x) is different from where the function is approaching from the right and the left the limit does not exist.

      Hope this helps, if you need a clarification let me know.
      (2 votes)

Video transcript

- [Instructor] Let's think a little bit about limits of piecewise functions that are defined algebraically like our f of x right over here. Pause this video and see if you can figure out what these various limits would be, some of them are one-sided, and some of them are regular limits, or two-sided limits. Alright, let's start with this first one, the limit as x approaches four, from values larger than equaling four, so that's what that plus tells us. And so when x is greater than four, our f of x is equal to square root of x. So as we are approaching four from the right, we are really thinking about this part of the function. And so this is going to be equal to the square root of four, even though right at four, our f of x is equal to this, we are approaching from values greater than four, we're approaching from the right, so we would use this part of our function definition, and so this is going to be equal to two. Now what about our limit of f of x, as we approach four from the left? Well then we would use this part of our function definition. And so this is going to be equal to four plus two over four minus one, which is equal to 6 over three, which is equal to two. And so if we wanna say what is the limit of f of x as x approaches four, well this is a good scenario here because from both the left and the right as we approach x equals four, we're approaching the same value, and we know, that in order for the two side limit to have a limit, you have to be approaching the same thing from the right and the left. And we are, and so this is going to be equal to two. Now what's the limit as x approaches two of f of x? Well, as x approaches two, we are going to be completely in this scenario right over here. Now interesting things do happen at x equals one here, our denominator goes to zero, but at x equals two, this part of the curve is gonna be continuous so we can just substitute the value, it's going to be two plus two, over two minus one, which is four over one, which is equal to four. Let's do another example. So we have another piecewise function, and so let's pause our video and figure out these things. Alright, now let's do this together. So what's the limit as x approaches negative one from the right? So if we're approaching from the right, when we are greater than or equal to negative one, we are in this part of our piecewise function, and so we would say, this is going to approach, this is gonna be two, to the negative one power, which is equal to one half. What about if we're approaching from the left? Well, if we're approaching from the left, we're in this scenario right over here, we're to the left of x equals negative one, and so this is going to be equal to the sine, 'cause we're in this case, for our piecewise function, of negative one plus one, which is the sine of zero, which is equal to zero. Now what's the two-sided limit as x approaches negative one of g of x? Well we're approaching two different values as we approach from the right, and as we approach from the left. And if our one-sided limits aren't approaching the same value, well then this limit does not exist. Does not exist. And what's the limit of g of x, as x approaches zero from the right? Well, if we're talking about approaching zero from the right, we are going to be in this case right over here, zero is definitely in this interval, and over this interval, this right over here is going to be continuous, and so we can just substitute x equals zero there, so it's gonna be two to the zero, which is, indeed, equal to one, and we're done.