Main content

### Course: Algebra (all content) > Unit 7

Lesson 16: Shifting functions# Shifting functions examples

Sal analyzes two cases where functions f and g are given graphically, and g is a result of shifting f. He writes formulas for g in terms of f and in terms of x.

## Want to join the conversation?

- at2:23, why did Sal do x minus the horizontal shift and x plus the vertical shift? is there some kind of rule that explains why the horizontal shift must be subtracted and the vertical shift must be added?(29 votes)
- there isn't a rule that you follow for subtracting and adding the horizontal shift and vertical shift, it just depends on what directions you went on the graph.(6 votes)

- Can someone please explain a little further what the second question is asking?

what is the connection between g(x)= f(x+2)+5 and f(x) = sqrt(x+4)-2 ?(10 votes)- so you're trying to write an expression in terms of
**x**for**g(x)* right?**and you have the expression for

You have the expression for *f(x)* which is *f(x)+*sqrt*(x+4)-2**g(x)* after solving, which is *g(x)=f(x+2)+5**.

But now, you have**f(x)* in your equation for *g(x)*. In order to get rid of that and have an equation for *g(x)* you need to solve both the equations.**with the expression for

Now you put them all together like he did at5:53by substituting for *f(x)=*sqrt*(x+4)-2**g(x)= f(x+2)+5**.

~ f(x+**2**)=*sqrt*(x+**2**+4)-2

~f(x+**2**)=*sqrt*(x+6)-2

~f(x+**2+5**)=*sqrt*(x+6)-2+**5**

~f(x+**2+5**)=*sqrt*(x+6)+3

~and since**f(x+2+5)=g(x)***

--> *g(x)=*sqrt*(x+6)+3

I hope I cleared something up instead of messing you up more.(10 votes)

- I can not visualise this 'negative' for vertical and 'positive' for horizontal. Can someone explain? Why we are shifting like this?(6 votes)
- Could you be a little more specific with "negative for vertical" and "positive for horizontal"? I don't quite understand what you are asking. Or maybe you could give me a timestamp from the video you are watching, so I can help you?(11 votes)

- Sal... Tell me if I am wrong... but the way I think about it is this is somewhat like completing the square. When you complete the square and find a value for C. Like Sal says you can't just willy-nilly add "C" without either adding that same amount to the other side or subtracting from the same side. In this case you are "extracting" a given value from X. This forces "X" to make up for it. For Example: If I have to have a pile of marbles that are equal to "X" amount, but I know I will have someone come along and take two marbles before I even start counting them, then I need to have X be equal to two more marbles. Substitute X for a number. I can either have X be equal to 10 or 12-2. Again... subtracting 2, forces my starting X value to be worth 2 more. Am I on the right track?(10 votes)
- well this is what i think , if you substitute the value x with 2 then you will be subtracting the two marbles that you did not even count on together with the other ones.(3 votes)

- I know that f(x)= √(x+4) -2.

If we put x=√(x-4) -2 into f(x+2),

I think it should be √(x+4) +2 instead of √(x+2+4)

I'm really confused. Really appreciated someone can help me!(5 votes)- f(x)= √(x+4) -2 and you are trying to find f(x+2)

The "x+2" is your input value. You replace the "x" in the function with "x+2"

The "x" is inside the square root. So, that "x" changes to "x+2"

f(x+2)= √(x+2+4) -2

What you calculated is f(x)+2. The 2 in your scenario is not an input. You just added 2 to the entire function.

Hope this helps you see the difference.(8 votes)

- At4:45, why does Sal shift the blue line ( I honestly don't know what we call it ). Can't we shift the pink one?(6 votes)
- We can just call the blue line f(x) cause it's the name, likewise the pink line g(x).

The question that's raised is "what is g(x) in terms of f(x)?" That means, we have to shift f(x) until it matches g(x).

If the question asks "what if f(x) in terms of g(x)?" then we will have to shift g(x) until it matches f(x).

Everything is dependent on what the question asks for, so watch out for that. Hopefully that helps !(5 votes)

- Hi, it is first time I do math online . I can't figure out the format for typing my answers.

I am going back to school in the fall and my class is given only online. I am not very good with computers, and I am really freaking out. Is there tutorials for this?(4 votes)- You are in luck. There is a page in the help section called "How do I enter math symbols in an exercise?"

Try looking at : https://khanacademy.zendesk.com/hc/en-us/articles/202896260-How-do-I-enter-math-symbols-in-an-exercise-(7 votes)

- I have to say Sal is usually very clear in all his videos but this one has been really brushed off quickly! The steps are quick and not easy to follow. I thought about it today (all day), I came up with a system/way to digest this. At the end, if we consider where Sal started from and where he arrived it all makes a little more sense:

f(x)= √(x+4) -2

g(x)=√(x+6) +3

----------------

g(x)=f(x+2)+5

I note here from +4 to get to +6 I need +2 and from -2 to get to +3 I need a +5. Now the problem is how did he actually do it? The steps in the middle are chaotic and really not clear...(7 votes) - I was wondering; Why is it that in a normal number line, we would move to the right, being the positive side, but while during function shifts, we move to the left, and the other way around for the negatives? Why don't we move the same way according to the number line?(4 votes)
- The horizontal shift took me 3 days to understand. Allow me to explain what I've concluded for those that may struggle with it.

In the first graph Sal shows, we want f(x) to add up to it's current position at +3, but have the new x actually be -1. So how do we do that? We add 4. Because for f(x+4) to equal to 3, x must be -1. f(-1+4) = 3, thus x is -1.

Hopefully I explained that well enough to make sense.(5 votes)

## Video transcript

- [Voiceover] So we have these two graphs that look pretty similar, y equals f of x and y is equal to g of x. And what they asked us to do is write a formula for the
function g in terms of f. So let's think about how to do it and like always pause the video and see if you can work
through it on your own. All right, well, what I'd like to do is I'd like to focus on this minimum point because I think that's a
very easy thing to look at because of them have that minimum point right over there. And so we can think,
but how do we shift f? Especially this minimum point, how do we shift it to get
to overlapping with g? Well, the first thing that
might jump out of this is that we would want to shift to the left. And we'd wanna shift to the left four. So let me do this in a new color. So I would wanna shift to the left by four. We have shifted to the left by four or you could say we
shifted by negative four. Either way, you could think about it. And then we're gonna shift down. So we're gonna shift, we need to go from y equals two to y is
equal to negative five. So let me do that. So let's shift down. So we shift down by seven or you could say we have
a negative seven shift. So, how do you express g of x if it's a version of f of x
that shifted to the left by four and shifted down by seven. Or, you could say I have a
negative four horizontal shift. I have a negative seven vertical shift. Well, one thing to think
about it is g of x, g of x is going to be equal to f of, let me do it in a little darker color, it's going to be equal to f of x minus your horizontal shift, all right, horizontal shift. So x minus your horizontal shift plus your vertical shift. So plus your vertical shift. Well, what is our horizontal shift here? Well, we're shifting to the left so it's a negative shift. So our horizontal shift is negative four. Now, what's our vertical shift? Well, we went down so
our vertical shift is negative seven. So it's negative seven. So there you have it. We get g of x. Let me do that in the same color. We get g of x is equal to f of x minus negative four or x plus four and then we have plus negative seven or you can just say minus seven. And we're done. And when I look at things like this, the negative seven is somewhat, it's more intuitive to me. As I shifted it down, it made sense that I have a negative seven. But first, when you work on these, you say, "I shifted to the left. "Why is it a plus four?" And though I think about it is in order to get the same
value out of the function, instead of inputting,
so if you want to get the value of x of zero,
you now have to put x equals negative four in. And then you get that same value. You still get to zero. So that's, I know if that helps or hurts in terms of your understanding, but it often helps to try out
some different values for x and see how it actually
does shift the function. And if you just try to get
your head on this piece, the horizontal shift, I
recommended, you know, not even using this example. Use an example that only
has a horizontal shift. It will become a little more intuitive. And we do, we have many videos that go into much more depth that explain that. Let's do another example of this. So here, we have y is equal to g of x in purple and y is equal to f of x in blue. And they say given that f of x is equal to square root
of x plus four minus two, write an expression for
g of x in terms of x. So first, let's me just try to, expression for g of x in terms of f of x. We can see once again, it's just a shifted version of f of x. And remember, I'll just
write it in general. So g of x is going to be equal to f of x minus your horizontal shift plus your vertical shift. And so to go from f to g, what is your horizontal shift? Well, your horizontal shift is, if you take this point right over here, which should map to that point
once we shift everything. Your horizontal shift is two to the left or you could say it's a
negative two horizontal shift. So that should be negative two. And then, what is a vertical shift? Well, a vertical shift is removed, we go from y equals negative
two to the y equals three. So we're shifting five up. So this is a vertical
shift of positive five. So your vertical shift is five. So if we just want to write g of x in terms of f of x like we just
did in the previous example, we could say g of x is
going to be equal to f of x minus negative two which is x plus two. And then we have plus five. But that's not what they asked us to do. They asked us to write. They, whoops. They asked us to write an expression for g of x in terms of x. And so here we're actually gonna use the definition of f of x. So let me make it clear. We know that f of x is going to be equal to square root of x plus four minus two. So given that, what is f of x plus two? Well, f of x plus two
is going to be equal to, everywhere we see an x,
we're gonna replace it with an x plus two. Square root of x plus two plus four minus two which is equal to the square root of x plus six minus two. Well, that's fair enough. That's just f of x plus two. Now, what is f of x plus two plus five? So f of x plus two plus five is going to be in this thing
right over here plus five. So it's going to be
equal to square root of x plus six minus two and I'm going to add five,
with a different color. So plus five, so plus five. And so what we end up with is going to be square root of x plus six minus two plus five is going to be plus three. So that is equal to g of x. Just as a reminder, what do we do here? First, I expressed g of
x in terms of f of x. Let's say, hey, to get
from f of x to g of x, I shift two to the left. Two to the left. So we're kinda intuitive, plus two makes it a shift of two to the left. This was minus two would be
shifted two to the right. But like I just said in
the previous example, it's good to try it some x's and to see why that makes sense. And then we shifted five up. So this was g of x in terms of f of x. Then they told us what f of
x actually is in terms of x. So we said, "Okay, well,
what is f of x plus two?" F of x plus two, we
substituted x plus two for x and we got this. But g of x is f of x plus two plus five. So we took what we figured
out f of x plus two is and then we added five
and that's what g of x is. And then we are all done.