Main content

## Algebra 1

### Course: Algebra 1 > Unit 8

Lesson 1: Evaluating functions- What is a function?
- Worked example: Evaluating functions from equation
- Evaluate functions
- Worked example: Evaluating functions from graph
- Evaluating discrete functions
- Evaluate functions from their graph
- Worked example: evaluating expressions with function notation
- Evaluate function expressions

© 2023 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# What is a function?

Functions assign a single output for each of their inputs. In this video, we see examples of various kinds of functions. Created by Sal Khan.

## Want to join the conversation?

- at7:26why is y a square root of three? why not 3 squared?(158 votes)
- You have to remember that in algebra, what is done to one side of the equation has to also be done to the other side of the equation. When y^2 = 3, in order to find out what y is equal to, you have to get rid of the square. If you square 3, you also have to square the other side of the equation to make it equal. 3^2 would be equal to y^4, which doesn't really help us. Instead, get rid of the square by getting the square root of y squared (which is equal to y) and then finding the square root of the 3.(377 votes)

- So, one day, I asked my dad if a function could be graphed as a circle. He said yes. But I said no because I thought there would be more than one output of the input. For example, see this program I made:

https://www.khanacademy.org/cs/a-function/1860626452

My dad said yes because he said you could find the absolute value of both sides, but I didn't think of it that way. Can someone tell me: who is correct?(161 votes)- Ωπ fαz919 πΩ ,

By definition of a function, a circle cannot be a solution to a function.

A function, by definition, can only have one output value for any input value. So this is one of the few times your Dad may be incorrect. A circle can be defined by an equation, but the equation is not a function.

But a circle can be graphed by two functions on the same graph.

y=√(r²-x²) and y=-√(r²-x²)

If you look at this program, you will see that it used two functions to create the graph: http://www.khanacademy.org/cs/xr-yr-1/1807411349(180 votes)

- What's the difference between functions in algebra and functions in programming languages? Is here one?(114 votes)
- They are very similar. I think the best way to put it is that a math function takes in some mathematical construct (be it a number or some other variable or even another function) and spits out a mathematical construct, usually a value.

In programming, a function takes in some construct that is defined by the programming language (numbers, strings, classes, the results of another function) and returns a construct defined by the language.(33 votes)

- I don't get how Sal got h(2)=3 and h(8)=11. someone help please?(64 votes)
*The next largest number that starts with the same letter as*2 is 3.

They both start with the letter t. In the same way,*The next largest number that starts with the same letter as*8 is 11. They both start with e.(27 votes)

- why are there two variables?(16 votes)
- If you mean, "why does f(x) contain two variables?", please note the f is not a variable. The f is just a way for you to know that when you see f(x) to treat it as a function and not mistakenly treat it as multiplying one variable by the other (it DOES NOT mean f multiplied by x). It does not have to be an f, it can be any symbol and using different symbols such as h(a) helps differentiate one function from another.(49 votes)

- my brain hurts. help(26 votes)
- Can a function have multiple inputs? If so, how would you graph said function?(10 votes)
- Yes, a function can have multiple inputs. We can graph in the coordinate plane when we have 1 input to 1 output. If we have a function with 2 inputs to create 1 output, we can graph in a 3 dimensional graph of (x, y, z). Once you go to even higher inputs, we typically would not graph them as we don't what a 4-dimensional space looks like.(19 votes)

- Hi! I was wondering if there is a relationship between the equation describing how to plot a circle (6:30) and the Pythagorean theorem.(8 votes)
- Yep, there definitely is.

Let's consider a circle with center (0, 0) (to make the explanation a little simpler) and radius 3. Let's find some points on the outer edge of the circle.

A noticeable one is (3, 0) (3 units away from the center). Let's try to make a right triangle, where the center of the circle is one vertex, and its opposite vertex is the outer edge. Since this is a right triangle, we should be able to apply the Pythagorean theorem. The base of the triangle would be the x-axis, and the adjacent side would be some y-value. The hypotenuse would be the radius of our circle. Thus, a = x, b = y, and c = r. Using this in the Pythagorean theorem, we find:

x² + y² = r²

Does this work for the point we selected (aka (3, 0))?

3² + 0² = 3² → 9 + 0 = 9 → 9 = 9 ✓

You will find that this works for**every single point**on the circle. For example, another point on our circle is (3/√2, 3/√2). Does this work in our equation?

(3/√2)² + (3/√2)² = 3² → (9/2) + (9/2) = 9 → 18/2 = 9 → 9 = 9 ✓

When you use this equation with every possible x-value and y-value and graph the points you are able to make, you will construct a circle.(20 votes)

- What does the f stand for?(6 votes)
- Basically, the concept of functions gives us a way to name the whole

process of evaluating a particular expression, so we can talk about

it as a whole. We can compare different functions, discuss their

properties, or actually operate on functions to make new functions.

It also broadens the concept, because not all functions can be

written as a simple expression. These two processes, naming things

and extending them, are central to what mathematics is all about.

For example, the first function you showed can be called 'squaring',

and the second can be called 'adding 3'; but most functions would

have to have much more complicated names. By calling one F and the

other G, we have a simple way to discuss them. Some functions, like

the square root and the absolute value, can't be expressed in terms

of more basic functions, but only by inventing a whole new symbol. In

fact, we like to write the square root as 'sqrt(x)', using function

notation, because we don't have the symbol available in e-mail.

We can also treat these names like variables, where we don't know what

specific functions we are calling f and g, yet we can say general

things about the relation of f and g, proving that something is true

for ANY functions, or at least for any functions of a certain type,

all at once. That is powerful!(6 votes)

- Does anyone realize that you once you send a question/comment then leave this page your comment and your memory of it gets lost in time? It's like leaving a time capsule for other people to find.(15 votes)

## Video transcript

A function-- and I'm
going to speak about it in very abstract terms right
now-- is something that will take an input, and
it'll munch on that input, it'll look at that input,
it will do something to that input. And based on what that input is,
it will produce a given output. What is an example
of a function? I could have something
like f of x-- and x tends to be the variable
most used for an input into the function. And the name of a
function, f tends to be the most-used variable. But we'll see that you can
use others-- is equal to, let's say, x squared,
if x is even. And let's say it is equal
to x plus 5, if x is odd. What would happen if we
input 2 into this function? The way that we would
denote inputting 2 is that we would want
to evaluate f of 2. This is saying, let's input
2 into our function f. And everywhere we
see this x here, this variable-- you can kind
of use as a placeholder-- let's replace it with our input. So let's see. If 2 is even, do 2 squared. If 2 is odd, do 2 plus 5. Well, 2 is even, so we're
going to do 2 squared. In this case, f of 2 is
going to be 2 squared, or 4. Now what would f of 3 be? Well, once again, everywhere
we see this variable, we'll replace it with our input. So f of 3, 3 squared if 3 is
even, 3 plus 5 if 3 is odd. Well, 3 is odd, so it's
going to be 3 plus 5. It is going to be equal to 8. You might say, OK,
that's neat, Sal. This was kind of
an interesting way to define a function, a way to
kind of munch on these numbers. But I could have done this
with traditional equations in some way, especially
if you allowed me to use the squirrelly
bracket thing. What can a function do that
maybe my traditional toolkits might have not been
as expressive about? Well, you could even do
a function like this. Let me not use f
and x anymore, just to show you that the notation
is more general than that. I could say h of a is equal to
the next largest number that starts with the same
letter as variable a. And we're going to assume
that we're dealing in English. Given that, what is
h of 2 going to be? Well, 2 starts with a T.
What's the next largest number that starts with a T? Well, it's going
to be equal to 3. Now what would h of-- I don't
know, let's think about this, h of 8 be equal to? Well, 8 starts with an E.
The next largest number that starts with an E-- it's
not 9, 10-- it would be 11. And so now you see it's a
very, very, very general tool. This h function that we just
defined, we'll look at it. We'll look at the
letter that the number starts with in English. So it's doing this really,
really, really, really wacky thing. Now not all functions
have to be this wacky. In fact, you have already
been dealing with functions. You have seen things like
y is equal to x plus 1. This can be viewed
as a function. We could write this
as y is a function of x, which is
equal to x plus 1. If you give as an
input-- let me write it this way-- for example,
when x is 0 we could say f of 0 is equal to, well, you take 0. You add 1. It's equal to 1. f of 2 is equal to 2. You've already done this before. You've done things
where you said, look, let me make a table of
x and put our y's there. When x is 0, y is 1. I'm sorry. I made a little mistake. Where f of 2 is equal to 3. And you've done this before
with tables where you say, look, x and y. When x is 0, y is 1. When x is 2, y is 3. You might say, well, what
was the whole point of using the function
notation here to say f of x is equal to x plus 1? The whole point is to think
in these more general terms. For something like
this, you didn't really have to introduce
function notations. But it doesn't hurt to introduce
function notations because it makes it very clear that
the function takes an input, takes my x-- in this
definition it munches on it. It says, OK, x plus 1. And then it produces
1 more than it. So here, whatever the input
is, the output is 1 more than that original function. Now I know what you're asking. All right. Well, what is not
a function then? Well, remember,
we said a function is something that takes an
input and produces only one possible output for
that given input. For example-- and let
me look at a visual way of thinking about a function
this time, or a relationship, I should say-- let's
say that's our y-axis, and this right over
here is our x-axis. Let me draw a circle
here that has radius 2. So it's a circle of radius 2. This is negative 2. This is positive 2. This is negative 2. So my circle, it's
centered at the origin. It has radius 2. That's my best attempt
at drawing the circle. Let me fill it in. So this is a circle. The equation of
this circle is going to be x squared plus y squared
is equal to the radius squared, is equal to 2 squared,
or it's equal to 4. The question is, is this
relationship between x and y-- here I've expressed
it as an equation. Here I've visually drawn all
of the x's and y's that satisfy this equation-- is this
relationship between x and y a function? And we can see
visually that it's not going to be a function. You pick a given x. Let's say x is equal to 1. There's two possible y's
that are associated with it, this y up here and
this y down here. We could even solve for that
by looking at the equation. When x is equal to 1, we
get 1 squared plus y squared is equal to 4. 1 plus y squared is equal to 4. Or subtracting 1 from both
sides, y squared is equal to 3. Or y is equal to the positive or
the negative square root of 3. This right over here is the
positive square root of 3, and this right over here is
the negative square root of 3. So this situation,
this relationship where I inputted a 1
into my little box here, and associated with
the 1, I associate both a positive square root of
3 and a negative square root of 3, this is not a function. I cannot associate with my
input two different outputs. I can only have one
output for a given input.