### Stony Brook MAT 123 Fall 2015 Lecture 08: Piecewise functions, graph transformations September 21, 2015

 Start ...Functions... a piecewise is a function that is defined in pieces. so "Piecewise" Okay, so if a function is in pieces, then that means we divided up what we do with the functions So we have something very simple.. 0:32 Can be very straightforward, like that. And people get very confused about this, saying "I don't know what to do" Well.. what this means is you always have this part first. This is the domain. The domain is chopped up. Which means it can be numbers less than zero, or greater than and equal to zero. 1:00 And it says if you have a number less than zero, you use the function x + 2. And if you have a number greater than or equal to zero you use the function x - 2 So you really, theres two things going on piecewise functions are going to show up a lot here and in calculus Okay, so what you can use to define things that apply to piecewise functions Like lets say 2:05 Okay so I gave you a word problem because we love word problems We actually do love word problems One oh! Good question I forgot to mention that. So if you look on the course web page, which you can find from blackboard 2:31 at the very bottom we have stuff about midterm one. So I put in there, five chapters from my trigonometry book that go over basic stuff Radians, how to find sine, and cosine and all that stuff. And then you will have other practice material going up on there in the next couple days Also I put the stuff the stuff from my book in the document section For my lecture, I don't have acess to the other lectures Okay so if you go to the course webpage at the bottom, it says something, stuff about midterm one. Click on that, you'll see a bunch of stuff from my book. 3:07 We'll also put up practice problems, I don't know if we will have an actually sample exam but we'll have sample stuff A very good way to prepare for the exam is to go through the webassigns and the homework You want to get a feeling for the way professor Sutherland likes the questions okay so professor Sutherland likes the bulk of the exam, I just stand here and talk, he actually is his course 3:31 It's kind of ours but he writes the exams, so you want to get a feeling for what the questions will be like look at those. Okay you also should know We do not grade your exams, the TA's grade your exam I do not have any strength to grade all of your exams I would just get a rubber stamp that says C minus It would really speed things up I meant A plus sorry Right, yeah, yeah 4:00 This is an A plus right? No? Okay so that's where you can find a lot of stuff to help you prepare over the next week I also suggest that if you confused about something, you can watch the video over. We have the videos on the course webpage. You can watch me do my thing again for an hour, if you can stand it Or you have me, so we will have three or four minutes allow on each topic as well, okay? Put all that together Also next Monday and Wednesday will be review sessions. 4:31 But I am warning you now.. Wednesday is going to be right before the exam, the anxiety level tends to be very high Right? So Monday I'll do a lot of review. We will record that and it will be up again on Tuesday. I suggest you come to the review session, okay? That would be Monday, Wednesday will also be a review but a less of review because you guys will be just a wall. With my class you'll be nice arelax 5:00 Today and Wednesday will be the review material and that is it. So one thing is,piecewise, how would you right this as a piecewise function? Piecewise, again, means you are breaking into pieces First you make one of these cool, thoroughly brace this is called You ever wonder how to make that, a long s and then a backwards s and put them together Did anyone ever show you that before? Thats just a way of saying, I'm using the following things 5:32 10 dollars and hour for the first hour. So we say x is the number of hours Okay so its going to be 10 dollars times x. Assume x can be less than one hour, it can be a fraction That or zero up to 1 hour How bout more than an hour? Well now I charge 12 dollars and hour 6:01 For the next 5 hours, so that's not exactly right, is it? Why is it 12x? Right, we need to plus that, exactly. It will be 12 times x minus 1 to subtract the first power, so i this was 3 hours it would be 12 dollars time 2 hours plus 10. And that would be until you get up to, including hour number 5. 6:42 And then beyond that 14 dollars times x minus 5 hours, and then lets see. For four hours i spend 12 dollars an hour, that's 48 bucks And for the first hour I spent 10 dollars, so thats 58 dollars. 7:05 Again where does the 58 come from? 10 Dollars for the first hour Then four more hours, for 12 dollars an hour is a total of 58 dollars And then after that its 14 dollars times all the hours past 5 hours That's just an example on how you would do a piecewise function Yes? That's why its x minus 5. Okay? 7:32 Because theres 5.1 hours Okay? 5.1 minus 5 Sure it wuld be 6. If they say what happens behind 5 and 6 hours, yes? Sure question? Well okay, it's 10 dollars an hour so we work for a half hour. 8:01 You need 0 to get five dollars, so with a half hour you''l get 10 times a half Other wise i fire you x is the amount per hour. Also this isn't about real world example, Im just trying to provide a function This is the kind of thing, that you can shape with your boss. And you say you worked for 45 minutes and your boss says 3/4 at 10 dollars an hour. Wow 10 dollars And I just need 10 dollars to showing up and then he dont use you a full hour that's his bad. 8:32 You can write that kind of function, it;s kind of more complex. Okay, it's not that complex, you can use something gthat is a less than function So where does the 58 come from..one more time.I have the first hour, that's 10 dollars Then I have four more hours at 12 dollars an hour That's 58. So at the end of 5 hours you've earned 58 dollars 9:01 And then you get 14 dollars after that This shows up at real world stuff Because well you can use it with taxes, that's one variation Well we can go to a parking taxi meter, in a taxi in New York So much just to get in the cab and so much for every mile So these are all what this is all an example piecewise function So a more real world example, sorry the more mathy example. I can cover this? 9:37 Nope why is it only four times 12? Oh my apologizes I made it up to hour number 5 You are correct otherwise 10:03 Thank you, that's what you were saying. Got it. Okay this is gonna allow it Absolute value Functions, Wait. I'll Let everybody copy that 10:31 Absolute value of x Absolute value of x. If you are using a piecewise function So we love to test the absolute value of x. So what does the value of x mean? It means the distance from the origin MEans distance from zero We dont care about the sign, so the absolute value of 5 is 5 away from zero. which is 5. The absolute value of negative 5, is also 5 away from zer so it's also 5 11:02 When you think about zero Those are called the distance of 5 So we say absolute value, we just read and say how far away. We dont hear where the sign is So another way to think about absolute value is, as long as something is positive you dont have to do anything the the number But if something is negative, you switch the sign and the number. how do you switch a sign? You multiple it by negative 1. 11:33 As long as x is greater or equal to zero, the absolute value of that number is the number. Right? Absolute value of 3, is 3, absolute value of pi is pi and so on.. If x is a negative number All we do is switch the sign of x. So we will use absolute value over this class and first semester calc And we will expect you to think of it this way In a piecewise funtion 12:01 The functions can be broken into two different pieces One more, my favorite types You get something like this.. What does that look like? 12:34 You want to think of it as a piecewise function You say stuff, well as long as x is bigger than 5, the absolute value doesn't do anything.It is just x minus 5 over x minus 5 as long as x is greater than 5, I dont have to do anything to the absolute value So if x is 11, 11 minus 5 is 6. If that says 5.1, 5.1 minus 5 is .1. So I'll always get a positive answer 13:03 If x is less than 5, then things get interesting If x is less then 5, this is still x mins 5 But this will now become negative, so say x is 1.. 1 is less then 5, if we plug it in you'll get negative 4. Then after that you get 4 So what I do is I take 13:33 The thing inside the absolute number bars and multiply it by a negative number Just the way I did over here So as long as I am greater than 5, that's the number. what's inside the absolute value bar is positive, you don't have to do anything to it. If less then 5, what's inside will be negative so I have to multiple it by a negative sign Okay but first I didn't put it equal to 5. So the problem here is in the denominator 14:06 What's x minus 5 over x minus 5? 1 And the negative x minus over x minus 5, is negative 1. So this is just the function one as long x is greater than 5 and negative 1if x is less then 14:45 If we were to graph that That's what it looks like. As long x is greater then 5, i have 1 and if x is less then I have negative 1. And nothing is going on in the middle 15:11 Got the idea of piecewise functions? Let's do one more 17:22 A pool, doesn't have to be a swimming pool because it will take a year to fill up A pool filled with water, with 12 gallons for the first 3 hours and 10 gallons an hour of water after that. Express the amount of water in the pool as a piecewise function 17:55 So it fills with 12 gallons of water per hour for the first 3 hours. 18:02 So f of x is the amount of water after x hours So for the first 3 hours it's 12 gallons That, as long as x is greater then or equal to 3. Has to be a positive number of course Then what happens after 3 hours? Well 3 hours times 4 is the pool? 18:31 36 gallons after the first 3 hours Now, it will fill 10 gallons times x minus 3 Because its been more then 3 hours, so you have to subtract 3 from the number of hours I guess in theory it can go to infinity So if we asked in domain for example, the domain will be all numbers greater than or equal to zero. 19:01 Because you knwo how to fraction them out. Whole will be exactly hours, okay? Then it will be integers but every hour the gallons of the series just appear. If this was spilling smoothly we can have any number of hours you can't have negative hours You can have pi hours, sort of. I mean it would be a really weird way to do it, okay. So the domain will be all numbers greater then or equal to zero 19:31 Alright, how much water is in the pool after 10 hours? Well we had 36 gallons after the first 3 hours and then you have the 10 hours. Well for the next 7 hours we got 10 gallons an hour thats 70. will give you 106 Does that make sense? Have any trouble with that? 20:35 Okay how did we do on this one? Do we understand the concept of what a piecewise function is? IT's really not that hard... yes? You can have 0 gallons and 0 hours. why is it greater than zero and not just 0. 21:04 In reality it doesnt make much of a difference Should I do another version of this? So we can understand piecewise? Let's talk a bit about transformation of a function This is going to show up a lot, especially in graphing 21:57 Transformation if we were to take a function and change it into some way 22:03 Whats happening when you transform a function, really what we are doing moving the x and y axis So originally the function is some place on the x axis So you have Some function sitting on the x axis and you sort of slide it. So let's say thats the origin. And you move it to the right and now it's out here. That's a transformation, we moved a funcion 22:36 From there to there. So how do we do that? We take the original function, and sort move x to the right or the left. What is happening is Let's say this is the number 2 and this must be the number 5. We moved it 3 units to the right So another way to think about it is 23:02 This point is f of 2. And if its at five and we moved it 3 to the right, we have to get the same value of what we got before when we had 2 So you will have to have 5 minus 3 When take away the 3 so we are also plugging 2 in here Does that make sense? So you guys probably di this in high school and never understood why when you subtract it you move it to the right. You wind up thinking thats move to the left 23:32 Because you are taking away But what really happens is in order to get youre originally function value when you plug in a number you have to subtract whatever you shifted to get that back to that value okay so if this was f of x that one has to be f of x minus 3 And that will shift the curve 3 units to the right So put it back where it started, you take away the 3 24:01 When you want to move it 5 units to the right, you do x minus 5. So if you want to move it h units to the right, youll have x minus h You need a new rule to help you live by What to make sure you go the basic idea down 25:06 To move it h units to the right, you have to do f of x minus h. 25:31 What does that mean? Lets say I had y pr f of x would be better. If it was x squared That looks something like that, a basic parabola So f of x minus 5 squared, 26:00 Yes? Now it will look like that. That's not very complicated, right?I moved it 5 units to the right 26:31 So everything moved 5 to the right. Because now here when I plus in 0, I get 0 squared and here when I plug in 5, I get 5 minus 5 is 0 squared. Well the function is x squared. So this goes through lets say I plug in a 3 I get 9 SO here I plug in 8 8 minus 5 is 3, 3 squared is 9 27:01 So the y value isn't changing. What' happening is the x value is changing. In order to get back to where I started I have to subtract the number You want to think about what's going on, in case it gets letters or pictures and things. But we also want to make different rules and use both ways Okay we are going to shift something to the left Well its the negative of that, so I would add 27:37 We have a little app for this on the webpage. You can actually take a graph and move a slider back and forth and watch the graph slide back and forth Because what is happening is The curve is staying where it is and to make sure to move the axis You can even say the axis stand still and we are moving the curve. or the curve stays still and we move the axis, its kinda the same thing 28:06 That make sense? To shift H units to the left use f of x plus h That should make sense 28:31 Add the number the inside will make it move to the left Subtract the number and move it to the right When it says inside a parenthesis, suppose we had Then we are effecting what is happening to the x value so if I wanted to shirt this 10 units to the left 29:01 This will become f of x plus 10 Now we take x and replace it by x plus 10 That make sense?This is why you can use simplify to take away the squareroot. To say wheres the difference from square root of x plus 2 and the square root o f x plus 10 plus 2 is a graph 29:31 The first one is located subvise and the second one is 10 units to the left So all the y values will move over here, 10 units to the left of the other function The square root of x plus 2 kind of looks like this. Thats a negative 2. The square root of 10 plus 10 plus 2, is there. Same curve shifted 10 units to the left 30:03 Who's confused? Not Bad, you guys should've seen this in high school I know everybody gets this in the regents and stuff like that Okay now we are going to move up and down 31:01 So if we want to move a curve up, we will add k or move the graph down and subtract k So f of x equals x squared 31:34 Looks something like that f of x equals x squared plus 2. Is now shifted up 2. So again you can think of this as we took the curve and moved it up too or we took the axis and you dropped them 2 Its the same thing. Either the curve moved up or the axis moved down and theyll end up in the same place 32:03 You guys see that over on that side? Now for the fun part, to do both What we call transformation 32:39 Say I had the following graph 33:04 So I have a graph that looks like that, and I'll call that f of x Lets think of what f of x minus 1 would look like 33:34 So if I want to do f of x minus 1, Everything moves one unit to the right So one think you can do, is think of the actual coordinate. So here I am at negative 2 and 2 So now I'm gonna move one to the right and get negative 1 and 2 Here at negative 1 I am at zero. So now it is zero zero. zero 2 moves to 1,2 and so on 34:17 The graph hasn't moved up or down, so the y values stay the same. All that happened with the graph is we picked up the graph and shifted it One unit to the right. Everyone see that? 34:38 Nice and simple? So lets take the same graph and now lets shift it down 35:08 We will have x minus 2 So notice what happens, when you have something inside the parenthesis you change the x values. So the marking on the x axis are shifted if you want to think of it that way When I do f of x minus 2, I already found f of x now I am subtracting and effecting the y values not the x values 35:31 You can think of it as y equals f of x So now we take this curve and everything will come down too So with negative 2, I'll now be at 0. At negative 1, I'll be down here at negative 2 With the origin I do that to there 36:01 So I took the graph And I am going to drop the graph 2 Does that make sense? You know whats coming Okay lets see if you guys can do Take a minute and see what that graph looks like 36:33 It looks just the way it did before So first what happens is basically the axis moved or the function moved you can think of it either way Theres a couple more motions you can learn, I can stretch and shrink it How did we do on this one? Yes, no? Everybody who loved this and continue to love this even if you had nightmares in high school the nightmares back 38:07 So what do we mean stretch? We literally mean make the graph longer and skinner. It gets a little tricker when we mean the word stretch 38:44 It will look something like this.. So I have f of x equals x squares and 3x squared Because what am I doing? I am taking each of the y values and dividing it by 3 For example 39:00 This goes through 1 comma and 2 comma 4. Now I multiple things by 3 to make it up to 1 I am at 3 and when I get to 2 I am at 12 So I took the graph and kind of stretched it Stretch is easy. mathematicians don't really want to use a word like stretch. What we did was you took it in the reverse direction and you spread out the numbers 39:32 By multiply it by 3 And to get it to compress, go in horizontally I multiply it by 3 Why does that compress it? Or it thined again? What is the difference between f of x and f of 4x. Well here when I plug in 4, I get f of 4. Here when I plug in 1 I get f of 4. 40:05 Here when I plug in 8 I get f of 8 and here when I plus in 2 I get f of 8 I need much less, right? Im going to have 1, f of 1 and I have 4 and whereever f of 4 is. Here Adds up... I'm sorry That is 8 40:34 Sorry I have to rewrite this Here at 4, I have f of 4. At 8 I have f of 8 And here at 1 I have f of 4, and 2 I have f of 8 41:02 So the graph squeezes in, 4 times 2 is 8. Thats why you get a horizontal compression With this amaze function, I can do a bunch of things to it If I was to write an exam question, I would ask you to do that And may or may not 41:53 So Lets make a function 42:08 So lets say this is f of x 42:37 2 f of x minus 1. So the 2 is going to stretch it So shove it in the verticla direction and the minus 1 is going to move it 1 to the right So that means its going down What does 2fx do? You will double all the y values 43:00 And then subtract 1 and you'll move everything down 1 So first you double everything. You should do it in pieces that will often help If you want to do 2f of x make, just take the original function and double everything So it looks sorta Like that Instead of going up to 4 you now go up to 8 So you took the original graph 43:31 And you stretched it Okay and heres IF I want to move it down 1 I just have to take the whole thing and shift it down 44:31 Well Im doing it in two sets, that part is just the true f of x, this is the 2f of x minus 1 Right away you can think this is a composite function because the f of x is now inside a new function 45:04 Yes? Does it matter if you stretch or compress it before you shift it? Try it and see what happens Generally you should do the 2f of x first before you then add or subtract a number And I always tend to do everything in the parenthesis before I do the outside of the parenthesis 45:35 What would happen if you first added or subtracted 1 Well what happen is you take the 4 and subtract it by 1 and get a 3. and if you doubled it you'll get 6. You wouldn't end up in the same spot PEMDAS 46:00 It shouldve, Its the bad artist Alright lets do one thats everything Start off with that same graph Now I want to do everything at once 46:39 Lets try that Support system tricks will make this easier to do So the one thing is to do it in pieces So what does f of 3x mean? Shrinking by 3 So we are going to do one step at a time. First we are going to define f of 3x. 47:12 First I am going to use f of 3x. F of 3x takes the whole graph and moves it in by 3 So where I have 1, I now have a 1/3. Where I had 3, I have 1 and Where I had 5 I have 5/3. So I take all the x values and divided them by 3 47:36 And squeezing that graph in by a factor of 3 Thats f of 3x So far so good? Now, Im going to multiple everything by 2 So I need to do 2 f of 3x 48:12 Okay so now the graph, Is still similar to before, again my artwork. But it is now twice as tall It sort of looks like it is tinier. It gets a little tricky, okay? It has to get up to 8 in the same amount of time it would have take before to get up to 4 48:32 Its going to be longated. When you stretch something you can make it thin And now I am going to add 1 49:03 Howd you do on that one? Not as bad as you thought? Do you have to make it look skinner? That's an excellent question. When I draw these graphs, I just change the numbers around But the graphs kind of all look the same That is fine. So what you are doing really, is you are changing the scale and the axis rather than the actual graph 49:37 Can you keep the scale the same way it would be. Yes you can do it either way. You can pinch the graph or the scale the way it would be in the same place Okay lets do one more Make sure everybody can do this 50:29 Okay that is our original graph 50:49 Look at that you have three transformations. So 4f of x minus 3 minus 1 51:05 I am just making this up, this isnt the function, id take a lot of work to figure out this function Okay so theres three things. First we are going to shift it 3 to the right, so we go 3 to the right Thats f of x minus 3 Kinda look like that 51:41 Okay now we can move 3 to the right and it still goes up to 3 and still goes down to negative 2 Okay thats your first step! So x minus 3 moves everything 3 to the right So thats our first strength of many Our second transformation is multiply by 4 52:04 So now you are going to take that picture and multiply it by 4 So instead of it coming down to negative 2 its going to come down to negative 8 Instead of going up to 3, it goes up to 12 52:35 So thats what multiply it by four does it takes it and stretches it by 4 and the last thing is to subtract by, subtract 1 53:25 Okay we got the idea? Alright so we will do more of this on wednesday and we will do some other stuff