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
Current time:0:00Total duration:9:34

Video transcript

Welcome to the presentation on functions. Functions are something that, when I first learned it, it was kind of like I had a combination of I was 1, confused, and at the same time, I was like, well what's even the point of learning this? So hopefully, at least in this introduction lecture, we can get at least a very general sense of what a function is and why it might be useful. So let's just start off with just the overall concept of a function. A function is something that you can give it an input-- and we'll start with just one input, but actually you can give it multiple inputs-- you give a function an input, let's call that input x. And you can view a function as-- I guess a bunch of different ways you can view it. I don't know if you're familiar with the concept of a black box. A black box is kind of a box, you don't know what's inside of it, but if you put something into it like this x, and let's call that box-- let's say the function is called f, then it'll output what we call f of x. I know this terminology might seem a little confusing at first, but let's make some-- I guess, let's define what's inside the box in different ways. Let's say that the function was-- let's say that f of x is equal to x squared plus 1. Then, if I were to say what is f of-- let's say, what's f of 2? Well that means we're taking 2 and we're going to put it into the box. And I want to know what comes out of the box when I put 2 into it. Well inside the box, we know we do this to the input. We take the x, we square it, and we add 1, so f of 2 is 2 squared, which is 4, plus 1. Which is equal to 5. I know what you're thinking. Probably like, well, Sal, this just seems like a very convoluted way of substituting x into an equation and just finding out the result. And I agree with you right now. But as you'll see, a function can become kind of a more general thing than just an equation. For example, let me say-- let me actually-- actually not, let me not erase this. Let me define a function as this. f of x is equal to x squared plus 1, if x is even, and it equals x squared minus 1 if x is odd. I know this would have been-- this is something that we've never really seen before. This isn't just what I would call an analytic expression, this isn't just x plus something squared. We're actually saying, depending on what type of x you put in, we're going to do a different thing to that x. So let me ask you a question. What's f of 2 in this example? Well if we put 2 here, it says if x is even you do this one, if x is odd you do this one. Well, 2 is even, so we do this top one. So we'd say 2 squared plus 1, well that equals 5. But then, what's f of 3? Well if we put the 3 in here, we'd use this case, because 3 is odd. So we do 3 squared minus 1. f of 3 is equal to 8. So notice, this was a little bit more I guess you could even say abstract or unusual in this case. I'm going to keep doing examples of functions and I'm going to show you how general this idea can be. And if you get confused, I'm going to show you that the actual function problems you're going to encounter are actually not that hard to do. I just want to make sure that you least get exposed to kind of the general idea of what a function is. You can view almost anything in the world as a function. Let's say that there is a function called Sal, because, you know, that's my name. And I'm a function. Let's say that if you were to-- let me think. If you were to give me food, what do I produce? So what is Sal of food? So if you input food into Sal, what will Sal produce? Well I won't go into some of the things that I would produce, but I would produce videos. I would produce math videos if you gave me food. Math videos. I'm just a function. You give me food and-- and maybe, actually, maybe I have multiple inputs. Maybe if you give me a food and a computer, and I would produce math videos for you. And maybe you are a function. I don't know your name. I would like to, but I don't know your name. And let's say if I were to input math videos into you, then you will produce-- let's see, what would you produce? If I gave you math videos, you would produce A's on tests. A's on your math test. Hopefully you're not taking someone else's math test. So it's interesting. If you give-- well, let's take the computer away. Let's say that all Sal needs is food. Which is kind of true. So if you put food into Sal, Sal of food, he produces math videos. And if I were to put math videos into you, then you produce A's on your math test. So let's think of an interesting problem. What is you of Sal of food? I know this seems very ridiculous, but I actually think we might be going someplace, so we might be getting somewhere with this kind of idea. Well, first we would try to figure out what is Sal of food. Well, we already figured out if you put food into Sal, Sal of food is equal to math videos. So this is the same thing as you of-- I'm trying to confuse you-- you of math videos. And I already determined, we already said, well, if you put math videos into the function called you, whatever your name might be, then it produces A's on your math test. So that you of math videos equals A's on your math test. So you of Sal of food will produce A's on your math test. And notice, we just said what happens when you put food into Sal. This could-- would be a very different outcome if you put, like, if you replaced food with let's say poison. Because if you put poison into Sal, Sal of poison-- not that I would recommend that you did this-- Sal of poison would equal death. No, no, I shouldn't say something, so no no no no. Well you get the idea. There wouldn't be math videos. Anyway. Let me move on. So with that kind of-- I'm not so clear whether that would be a useful example with the food and the math videos. Let's do some actual problems using functions. So if I were to tell you that I had one function, called f of x is equal to x plus 2, and I had another function that said g of x is equal to x squared minus 1. If I were to ask you what g of f of 3 is. Well the first thing we want to do is evaluate what f of 3 is. So if you-- the 3 would replace the x, so f of 3 is equal to 3 plus 2, which equals 5. So g of f of 3 is the same thing as g of 5, because f of three is equal to 5. Sorry for the little bit of messiness. So then, what's g of 5? Well, then we take this 5, and we put it in in place of this x, so g of 5 is 5 squared, 25, minus 1, which equals 24. So g of f of 3 is equal to 24. Hopefully that gives you a taste of what a function is all about, and I really apologize if I have either confused or scared you with the Sal food/poison math video example. But in the next set of presentations, I'm going to do a lot more of these examples, and I think you'll get the idea of at least how to do these problems that you might see on your math tests, and maybe get a sense of what functions are all about. See you in the next video. Bye.