No history yet

Input Output Logic

The Function Machine

Think of a function as a simple machine, like a vending machine. You press a button for a specific snack—that's your input. The machine whirs and drops that exact snack into the tray—that's your output. You press B4 for chips, you get chips. Every single time. You'd be pretty confused if you pressed B4 and sometimes got chips, and other times got a candy bar.

Mathematical functions work the same way. They are rules that take an input and produce a single, predictable output. This rule is the most important thing to remember about functions.

For every input, a function gives exactly one output.

Let's look at a simple function, like f(x)=x+3f(x) = x + 3. The 'f(x)f(x)' part is just a fancy way of naming the function and indicating that 'xx' is the input. If you put a 2 into this function machine, it adds 3 and gives you a 5. If you put in a 10, it gives you a 13. The output is completely determined by the input.

Domain and Range

In mathematics, we have specific names for all the possible inputs and outputs of a function.

The set of all possible inputs is called the domain. For our vending machine, the domain is the collection of all the buttons you can press (A1, A2, B1, B2, etc.).

The set of all the resulting outputs is called the range. The range for the vending machine is the collection of all the different snacks it can dispense. If the machine is out of candy bars, then candy bars are not in the range, even if the button for them is still in the domain.

Let's consider our function f(x)=x2f(x) = x^2. We can plug in any number for xx, so the domain is all real numbers. But what about the range? Since squaring any number (positive or negative) results in a non-negative number, the range is all numbers greater than or equal to zero. You can never get an output of -4 from this function.

Input (Domain)Rule: f(x)=x2f(x) = x^2Output (Range)
-2(2)2(-2)^24
0(0)2(0)^20
3(3)2(3)^29
5(5)2(5)^225

In computer programming, this concept is everywhere. A is a block of code that takes arguments (inputs) and returns a value (output). For example, a function int calculateSum(int a, int b) takes two integers as input and returns their sum as output. It follows the same core logic: consistent inputs produce consistent outputs.

The Vertical Line Test

Sometimes you'll see a relationship drawn on a graph, and you'll need to know if it's a function. There's a quick visual trick called the that makes this easy.

Here's how it works: imagine drawing a vertical line anywhere on the graph. If that line touches the graph in more than one spot, it is not a function. Why? Because a vertical line represents a single input value (an x-coordinate). If it hits the graph twice, it means that one input has two different outputs, which violates our main rule.

The parabola on the left passes the test. No matter where you draw a vertical line, it will only ever cross the curve once. The circle on the right fails. A vertical line can cross it in two places, meaning one input has two outputs.

Quiz Questions 1/6

What is the most fundamental rule of a mathematical function?

Quiz Questions 2/6

In the context of a function, what is the term for the set of all possible input values?