# How to make a "function"?

I dropped out of school early when I was still a teenager and now I'm trying to take my GED. I'm really close to passing but I'm still having trouble understanding some concepts.

In the pre-test, there is this question:

Add one number to each column of the table so that it shows a function. Do not repeat an ordered pair that is in the table.

$$\begin{array}{c|c} x & y \\ \hline 6 & 6 \\ 3 & 8 \\ 9 & 12 \\ 7 & 8 \\ \fbox{?} & \fbox{?} \end{array}$$

$$\fbox{ 3 }\quad\fbox{ 6 }\quad\fbox{ 7 }\quad\fbox{ 8 }\quad\fbox{ 9 }\quad\fbox{ 12 }$$

I'm not entirely sure what a function is, and I have found some questions on SE explaining it, I'm not really getting any of it. It's all confusing.

So I was hoping if someone could explain this question to me, and what's the answer, and why. I'm hoping this could help me understand the concept.

• Ever heard of the vertical line test? Jan 29, 2015 at 21:15
• No, @induktio.. Jan 29, 2015 at 21:18
• Check it out: en.wikipedia.org/wiki/Vertical_line_test. It will give you a pictorial way of thinking about Peter's answer. Jan 29, 2015 at 21:19
• Lots of good answers already, so I'll just leave a comment. My high school math teacher used to say "A function is like a vending machine. You push a button, it gives you food. Different buttons might give you the same food, but if you push the same button, it's going to give you the same thing every time." Jan 30, 2015 at 12:08
• I'm voting up just in support of your efforts to earn a GED. Jan 30, 2015 at 20:36

The other answers are good. I thought I would include these pictures from Wikipedia because, while you can visualize a function as a graph on $x,y$ axes, I also like visualizing functions as objects connected by arrows.

Here we have an example of a function that turns $x$'s into $y$'s just by traveling along the arrows. This is a perfectly good function because there is no ambiguity. We can see that $f(1)$ gives us $D$, $f(2)$ gives us $C$, and $f(3)$ gives us $C$ as well.

This next example is not a function, because one of the inputs ($2$) has more than one output. We can see that $f(1)$ is $D$, but what about $f(2)$? We can't decide what it is because there is more than one output. So this is not a function. Rather, it is a relation.

(In case you're disturbed that the outputs are letters and not numbers... functions can connect any two collections of "things". These things don't have to be numbers, but they often are.)

• A question: Is y = $x^{sin(x+y^2)}$ a function too? I don't get what the difference between functions and equations is. Oct 18, 2017 at 10:28

The key point here is that by definition, if $y$ is a function of $x$, then for each value of $x$ there is a single value of $y$ (Thanks to N.F. Taussig for phrasing).

Four $x$ values have already been determined, so we cannot reuse any of those. There are just two values left from our answer choices: $8$ and $12$. We can pick either of these for our $x$ value and anything we want for our $y$ value and we will have a function.

• I would suggest rephrasing your first sentence slightly to emphasize that if $f$ is a function of $x$, then for each value of $x$, there is exactly one value of $y$. Jan 29, 2015 at 21:20
• @N.F.Taussig Thanks! Jan 30, 2015 at 1:40
• Actually we can also pick any of the $x$ values already used, say $7$ or $9$—provided that the corresponding $y$ value is the same as before, i.e. $(7,8)$ or $(9,12)$, respectively... Jan 30, 2015 at 9:41
• @CiaPan The question prohibits that. Jan 30, 2015 at 11:45
• @PeterWoolfitt Right, I must have missed that. I apologize for that, the text size was too small for me, I suppose. Jan 30, 2015 at 11:48

There are enough answers explaining what a function is in general, so instead, I'd like to look at a particular function and discuss that.

Consider the graph of me walking to the grocery store to buy some pickled herring. I don't buy it all of the time, so when I go to the store, I really have to look for it.

On the horizontal axis is time ($t$), which represents the number of minutes since I left home, and on the vertical axis is the distance $(d)$, in meters, which represents the distance that I am from my house. Initially, the distance (from home) is increasing. This represent my walk to the store.

Then it alternates between increasing and decreasing as I go up and down the aisles because the west side of the store is closer to my house than the east side of the store is. What is interesting about this part of my trip is that I can be the same distance from my house at different points in time. In fact, I am $350$m from home no fewer than $6$ times. At times, I may even be in the same location, but I can never be in $2$ places at once (this is really what the vertical line test will tell me).

Finally, are the last two legs of my trip. There is a horizontal leg to this function, which represents me waiting in line at the cashier, and not moving at all, hence not going further away nor closer to home. And lastly, I gradually decrease my distance until it reaches $0$m (at about the $28$ minute mark).

There are a multitude of other scientific relationships where one quantity depends on another that are modeled as functions. Think about throwing a ball up in the air. The ball can be at the same altitude at two different times (on the way up, and on the way down), but cannot be at two different altitudes at the same time (there's that vertical line test again).

By the way, the pickled herring was delicious. • Stop lying. Pickled herring is never delicious. Jan 30, 2015 at 21:07
• inlanders ಠ_ಠ sheesh Jan 31, 2015 at 12:51
• i am not sure if you should use distance or position in this instant. i always think of the distance as increasing even when you backtrack as you are in the aisles.
– abel
Feb 7, 2015 at 21:45
• Certainly, were this answer presented in a university physics course, I agree, "position", or "displacement" would definitely have been more appropriate than "distance". As it is, the OP is just learning the concept of what a function is, and I don't think he would find that getting hung up on the semantics of "position" vs. "distance" would be very helpful. Feb 7, 2015 at 22:12

None of the other answers are wrong, but given you are self-taught, it might be illuminating to see some wrong answers.

## $x=6$, $y=6$

This is wrong because you're not allowed to give an ordered pair that's already provided. This isn't helpful for learning what a function is, but it's probably something you already understood.

## $x=6$, $y=7$

This too is wrong. The reason it's wrong is that the other rows in the table have already defined the function's $y$ value for $x=6$. And it's not $y=7$. The essence of a function (as opposed to a relation) is that there is only one $y$ for each $x$.

In fact, the only wrong answers are those which

• give a row that's already provided
• give an $x$ that's already provided, and give a $y$ that is different to the one next to the corresponding $x$

So the correct answer is: any $x$ that's not already in the $x$ column, with literally any $y$ in the other column. The first bullet point is just to prevent "cheating"; the second point is really what functions are about.

The picture below may help you think about this in a different light. As Peter pointed out, a function can only have a particular $x$-value paired with a single $y$-value. In the picture, the points $(6,6), (3,8),(9,12),(7,8)$ have been plotted.

Given the definition of a function, you need to choose an $x$-value that corresponds with a $y$-value "not already taken". For example, the point $(3,6)$, where $x=3$ and $y=6$, will not work because $(3,8)$ is already a point and $6\neq 8$. In the context of the vertical line test and the picture below, this would mean a blue dot would appear directly below the first blue dot. Since a vertical line would intersect both dots, then we would not have a function (this is the vertical line test). Of course, you could do something trivial like list the point $(3,6)$ in the table again and you would have a function, but the test makers anticipated this "cheat" by saying, "Do not repeat an order pair that is in the table."

As Peter pointed out, using an $x$-value of $8$ or $12$ and any correspondent $y$-value will do. In the context of the picture, this works because there is no dot on the line $x=8$ or $x=12$.

Dirty explanation, but maybe it will give you more intuition. It can't be wrong if all the values under $x$ in the table are different. That's because the $y$-value to a certain $x$-value must be unique.

Consider a simple analogy- "A person has to reach home from office by using his car as a transportation medium. Now the faster he drives his car the sooner he reaches his home i.e.. it takes lesser time to reach home. Here 'the speed of the car' becomes the FUNCTION of 'time taken to reach home' ".

If any value(say X) that depends on another value(say Y), then X is said to be a function of Y since the value of X depends on the value of Y. In the analogy above the time taken to reach home depends on the speed at which the car is traveling, hence time becomes a function of speed.

Let me talk mathematically,

Consider an equation: y=4+7x.

If I put the value of x as 2 then evaluating y, I get 4+7(2)=18=y. Here the value of y becomes 18 when the value of x is 2. Similarly the value of y is 39 when the value of x is 5. What we infer is that as the value of x changes the value of y also changes, in other words the value of y depends on the value of x. In other words y is said to be a function of x, as the value of y depends on that of x.

Mathematically it is written as f(x)=y or f(x)=4+7x(as given in the above example).

Where f=function, f(x)=function of x.

That's what 'function' means. Simple isn't it.

• you switched X and Y from those that are typically used and didn't highlight the difference between a function and a relation which is what the pre-test question is asking about.
– Rick
Jan 30, 2015 at 18:38