 In this video, I'm going to talk about writing functions. This is actually very similar to writing equations, but again, we're going to use function notation to write this out instead of writing equations like using x's and y's. We're going to use function notation instead. Okay. Just one quick example, a carnival charges $5 entrance fee to get into the carnival and $2 per ride. Write a function to represent the total cost after taking a certain number of rides. Okay. So now when we want to write a function, they don't give us a lot. They don't tell us what variables to use, nothing to that effect. We have to be kind of intuitive in what they want us to use here. And we also got to make some decisions of our own. What variables, what notation do we want to use? Now when you say function notation, you think of something like this. F of x equals negative two-thirds x minus five or plus five or something to that effect. When you think of a function, that is what you should think of. So that's what we want to do. We want to write a function, but we want to use the fact that the carnival charges a $5 entrance fee and it's $2 per ride. But we want our function that we write that represents this and we want to look like this down here. So that shouldn't be too terribly hard. The problem here is that I don't know what equations to use. I don't know what variables to use. And that's the thing is that when you don't have a lot of direction, you can use whatever you want to. So a carnival charges a $5 entrance fee and it's $2 per ride. So now when I go to the carnival, it's going to cost me some money. It's going to cost me $20, $25, $50 depending on how many rides I go on. So that's kind of where we're going to start. We're going to the carnival and it's going to cost a certain amount. So that's actually where I'm going to start. C is what I'm going to start with, cost C. So the cost of this carnival trip, that's what the C kind of stands for, the cost of the carnival trip. Now the thing is, when I start my function notation, I not only start with the label for it, so C is my label for the function notation, but then I also have to state what variable I'm going to use. So C of what? C of what? The parentheses. So I shouldn't have raced that. Let's write that back up there. F of x is equal to negative two-thirds x plus five. I think that's what I had up there earlier. So I want to write function notation, so in this case I had an F for function x for the variable that I'm going to use and that's what I have here in my equation. So I want to do the same thing for the carnival. So I have C for the total cost, that's kind of the name of the function, C is the name of the function, C for cost, and I got to decide what variable to use. Now a lot of students will like to use x because that's what they always use. I'm going to use something a little bit different because I want to get you into the habit of using a variable that makes sense, not just x because that's what you've always used, use a variable that makes sense so you understand what you're actually doing with the problem instead of just writing down variables. So a carnival charges five dollars and two dollars per ride, write a function to represent the total cost, so actually the total cost, that kind of helps us with our function, write a function that represents the total cost after taking a certain number of rides. That right there, that kind of gives you a hint on what variable you're going to be using. What if I take two rides? What if I take ten rides? What if I take fifty rides? What if I go to the carnival and I try all fifty rides at this huge carnival? How much is it going to cost me? Or how can I write a function to represent this, write this out beforehand and then if I write twenty rides or decide I want to write twenty rides I can see how much is going to cost me, or fifty rides and see how much is going to cost me. So in this case rides is the thing that's going to vary. I can ride ten times, I can ride twenty times, I can ride fifty times, I don't really know how many rides I'm going to go on. So that's going to be my variable, if you don't know something, if it's going to go up or down or whatever it's going to do, if that number is going to vary, that is going to be your variable. So in this case rides is my variable, so I'm going to actually, instead of using X like all the other kids use, I'm going to use R for my variable. So you can start to see us building this function notation. C of R, the cost for all the rides is equal to, so now we're going to go back up to our first bit of information. A carnival charges five dollar entrance fee and two dollars per ride. So it's going to cost me five dollars right off the bat. Okay, so my cost is five dollars right off the bat. And, plus, it's going to be two dollars per ride. Two dollars per ride. So if I have one ride, it's going to be two times one. If I have two rides, it's going to be two times two. If I have, I'm getting too many here, if I have three rides, it's going to be three, it's going to be two times three. If I have four rides, it's going to be two times four. Eight dollars plus the five that took me to get in here. Notice what's happening is that this number right here keeps varying. It keeps changing. Okay, so that gives you an idea of where the variable is supposed to go. Two dollars per ride to R. Two dollars per ride, okay? So the cost, the cost, which is our function here, whoops, excuse me, the cost, which is our function here, the cost is based on the number of rides, which is five dollars to get into the carnival plus two dollars per ride. That right there is how you write a function. And that's it. That's all you've got to write, okay? That's just one quick example of how to write a function. Notice how similar it looks to this one that we have up here. Again, a little bit of difference is here. This one is function f. This one is function c. This function is using the variable x. This function is using the variable r. This one has a slope of negative two-thirds. This one has a slope of two. This has a y-intercept of five, coincidentally. This has a y-intercept of five also. All right, so anyway, that is how you write a function. You really need to understand the problem before you can start writing functions. And you also need to decide what variables I'm going to do. What am I going to call the function? In this case, I'm talking about representing the total cost. So c for total cost after taking a certain number of rides, certain number of rides. Rides is going to be my variable. I can have 10 rides, 20 rides, 50 rides, something like that. So my cost is based on my rides. And here's the equation that represent that. Five dollars to get into the carnival plus two dollars per ride. And there is my function. Okay, that is writing functions. This is kind of a summary of what we did there. I hope you enjoyed watching this video, and I hope that it helped.