📘 CodingMarble Learn

Functions: Input, Rule, Output

A function is a rule that gives exactly one output for each input. We write it as f(x). The output f(a) is called the image of a; an input that gives a certain output is a preimage. A function can be shown as words, a table, a formula or a graph. Its graph can go up (increasing), go down (decreasing) and have a highest point (maximum) or lowest point (minimum).

🎬 Step-by-step story

  1. A function is like a machine. You put in a number, a rule works on it, and exactly one number comes out.
  2. We give the rule a name: f(x) = 2x + 1. f(3) = 7 means the output for 3 is 7. We say 7 is the image of 3.
  3. We can also go backwards. Which input gives 9? 2x + 1 = 9, so x = 4. The input 4 is called a preimage of 9.
  4. Put in 0, 1, 2, 3, 4, 5 one by one. Each input and its output make a point. Join the points and you get the graph.
  5. A new rule, h(x) = 6x − x², shows the height of a thrown ball. The graph goes up, reaches a top of 9 at x = 3, then comes down.
  6. Your turn: pick a rule and move x. See the machine and the point on the graph change together.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

Can two different inputs give the same output?

Yes. In h(x) = 6x − x², h(2) = 8 and h(4) = 8. The rule only forbids one input giving two outputs.

Why do we write f(x) and not just y?

f(x) shows both the name of the rule and the input. f(3) tells you at once which input was used. y is fine too: y = f(x).

How do I find a preimage?

Set the rule equal to the output and solve. For 2x + 1 = 9, x = 4. The 3D runs the machine backwards to show this.

Why is a graph made of points (x, f(x))?

Each input and its output are a pair. Across is the input, up is the output. Every pair is one dot on the graph.

What makes a point a maximum?

No other point on the graph is higher. For the ball, nothing is higher than 9 at x = 3.

Is the domain always all numbers?

No. It depends on the situation. Time cannot be negative; people cannot be counted in halves. Try the free play: each rule has its own x range.

What is a function?

Some quantities depend on others. The cost of pens depends on how many you buy. The input is the variable we choose. The output is what we get.

A function is a rule that gives exactly one output for each input. If one input could give two different outputs, it is not a function.

Function notation, image and preimage

We name a function with a letter, often f. We write f(x) = 2x + 1. Read it as “f of x equals two x plus one”.

Note: f(x) does not mean f times x. It is a name plus an input.

Domain and range

The domain is the set of inputs you are allowed to use. The range is the set of outputs you actually get. For the number of tickets sold, the domain is whole numbers only — you cannot sell 2.5 tickets.

Four ways to show a function

The same function can be shown in four ways. Learn to switch between them.

Vertical line test: on a graph, draw any up-down line. If it ever cuts the graph twice, one input has two outputs, so it is not a function.

To compare two functions, compare their tables or graphs: which one grows faster? Where are they equal?

Reading a graph: increasing, decreasing, maximum, minimum

Read a graph from left to right, like a sentence.

For h(x) = 6x − x² on 0 ≤ x ≤ 6: increasing from 0 to 3, maximum 9 at x = 3, decreasing from 3 to 6. A variation table writes this as arrows: ↗ up to 9, then ↘.

A sign table shows where f(x) is positive (+), zero (0) or negative (−). For f(x) = x − 2: negative when x < 2, zero at x = 2, positive when x > 2.

Functions as models of real life

A model is a function that describes something real. A phone plan costs ₹99 plus ₹2 per GB: C(g) = 99 + 2g.

Rate of change tells how fast the output changes per unit of input. From g = 1 to g = 5, C rises from 101 to 109: rate = 8 ÷ 4 = ₹2 per GB.

Optimisation means finding the best value — often a maximum or minimum. If a ball's height is h(t) = 6t − t², the ball is highest at t = 3 s.

Try it

Walk 10 steps, then 20, then 30 and time each walk with a phone. Make a table of steps → seconds. Is it a function? Draw its graph. Then open the free-play step in the 3D and test each rule.

Key formulas and definitions

Worked examples

1. f(x) = 2x + 1. Find f(5).

Put 5 in place of x: f(5) = 2 × 5 + 1 = 10 + 1 = 11.

2. g(x) = x² − 3. Find g(−2).

g(−2) = (−2)² − 3 = 4 − 3 = 1. Remember (−2)² = +4.

3. f(x) = 3x − 4. Find the preimage of 11.

Solve 3x − 4 = 11. Add 4: 3x = 15. Divide by 3: x = 5. So 5 is the preimage of 11.

4. Make a table for f(x) = 10 − x for x = 0, 2, 4, 6 and say if it is increasing or decreasing.

f(0) = 10, f(2) = 8, f(4) = 6, f(6) = 4. As x grows, f(x) falls, so f is decreasing.

5. A taxi charges ₹50 plus ₹12 per km. Write the function and find the fare for 8 km.

F(d) = 50 + 12d. F(8) = 50 + 96 = ₹146.

6. A ball's height is h(t) = 6t − t² metres after t seconds. Find the maximum height and when it happens.

Table: h(0)=0, h(1)=5, h(2)=8, h(3)=9, h(4)=8, h(5)=5, h(6)=0. It rises to 9 m at t = 3 s, then falls. Maximum height = 9 m at t = 3 s.

Common mistakes

Practice quiz

1. A function gives, for each input:
2. If f(x) = 4x − 1, then f(2) =
3. f(4) = 9. Here 4 is called the:
4. A graph going down from left to right shows a function that is:
5. Which test checks if a graph is a function?

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

What is a function in simple words?

A rule that turns each input into exactly one output, like a machine. Example: f(x) = 2x + 1 turns 3 into 7.

What is the difference between a relation and a function?

A relation links inputs to outputs in any way. A function is a special relation where every input has exactly one output.

What are image and preimage?

If f(a) = b, then b is the image of a and a is a preimage of b.

Where this is taught

NetherlandsVWO 4 (bovenbouw, 2e fase)Functions, graphs and equations (part 1)
RomaniaClasa a VIII-aFunctions
RomaniaClasa a X-aFunctions and equations
Spain2º ESOAlgebraic sense
Spain3º ESOAlgebraic sense
Spain4º ESOMeasurement sense
Spain4º ESOMeasurement sense
Spain1º BachilleratoAlgebraic Sense
Spain1º BachilleratoAlgebraic Sense
Spain1º BachilleratoAlgebraic sense and computational thinking
USA (Common Core, NGSS, AP)Grade 8Functions (8.F)
USA (Common Core, NGSS, AP)Grade 9Linear and exponential relationships
USA (Common Core, NGSS, AP)Grade 9Linear and exponential relationships
USA (Common Core, NGSS, AP)Grade 11Modeling with functions
USA (Common Core, NGSS, AP)Grade 11Mathematical modeling
USA (Common Core, NGSS, AP)Grade 12Polynomial and Rational Functions
Germany (Bavaria)Jahrgangsstufe 8Functions and terms
FranceQuatrièmeData, probability and functions
FranceTroisièmeData, probability and functions
FranceSecondeAutomatic skills
FranceSecondeFunctions
FrancePremièreAutomatic skills
FrancePremièreAutomatic skills
FranceTerminaleStudy themes
Russia7 классFunctions
Russia7 классFunctions
Russia8 классFunctions
Russia8 классFunctions
Russia9 классFunctions
China八年级(初二)Ch.22 Functions

Learn first

Learn next

Related lessons

All Maths lessons