Function Formula- Writing and Using Mathematical Functions
What a Function Actually Is
A function is a relationship between two sets where every input produces exactly one output. That's it. No more, no less. If you put in the same input twice, you get the same output both times. That's the core rule that separates functions from other mathematical relations.
Most people overthink this. Functions aren't complicated machinery. They're just rules that tell you how to transform one number into another. Think of it like a vending machine: you put in money (input), you get a snack (output). Same money, same snack, every single time.
Function Notation: The Basics
When you see f(x), that notation means "f of x" — you're applying the function f to the input x. The f is just the name of the function. You can call it anything: g(x), h(x), cost(x), whatever makes sense in context.
The parentheses don't mean multiplication. They're not f times x. They're notation telling you that x is the input going into the function f.
If f(x) = 2x + 3, then:
- f(2) = 2(2) + 3 = 7
- f(5) = 2(5) + 3 = 13
- f(-1) = 2(-1) + 3 = 1
Common Types of Functions You Need to Know
Linear Functions
Linear functions graph as straight lines. The general form is f(x) = mx + b, where m is the slope and b is the y-intercept. These are the simplest functions you'll encounter.
Example: f(x) = 3x - 4
Quadratic Functions
These produce parabolas — U-shaped graphs. The general form is f(x) = ax² + bx + c, where a cannot be zero.
Example: f(x) = x² - 5x + 6
Polynomial Functions
These have variables raised to whole number powers. Linear and quadratic functions are actually special cases of polynomials. A polynomial can have any number of terms with various powers.
Example: f(x) = 4x³ - 2x² + 7x - 1
Exponential Functions
When the variable sits in the exponent, you have an exponential function. These grow or decay rapidly. f(x) = aˣ where a is a positive constant.
Example: f(x) = 2ˣ — this doubles for every increase in x
Trigonometric Functions
sin(x), cos(x), tan(x) — these deal with angles and circular motion. They repeat in patterns, which makes them useful for modeling anything that cycles.
Domain and Range: What Can Go In and Come Out
Domain is all the valid inputs a function accepts. Range is all the outputs that result.
For f(x) = 1/x, the domain excludes x = 0 because you can't divide by zero. For f(x) = √x, the domain is x ≥ 0 because you can't take the square root of negative numbers (in real mathematics, anyway).
Always check what values would break your function. Division by zero, negative square roots, logarithms of zero or negative numbers — these are the usual suspects.
How to Write a Function: The Practical Part
Writing a function starts with identifying the relationship between variables. Ask yourself: what operation transforms the input into the output?
Example 1: A taxi charges $3 base fare plus $2 per mile. Write the cost function.
cost(miles) = 2miles + 3
Example 2: A rectangle's area in terms of its width, if the length is fixed at 8.
area(width) = 8w
Example 3: Convert Celsius to Fahrenheit.
F(c) = (9/5)c + 32
Notice the pattern: identify your input variable, identify the operation or operations, write it out. The hard part isn't the math — it's correctly understanding what the relationship actually is.
Function Composition: Putting Functions Inside Functions
You can chain functions together. If f(x) = x + 2 and g(x) = 3x, then f(g(x)) means "apply g first, then apply f to the result."
f(g(x)) = f(3x) = 3x + 2
g(f(x)) = g(x + 2) = 3(x + 2) = 3x + 6
Order matters. f(g(x)) and g(f(x)) usually give different results.
Comparing Common Functions
| Type | Form | Key Characteristic | Graph Shape |
|---|---|---|---|
| Linear | f(x) = mx + b | Constant rate of change | Straight line |
| Quadratic | f(x) = ax² + bx + c | Variable rate of change | Parabola (U-shape) |
| Exponential | f(x) = aˣ | Percentage growth/decay | J-shaped curve |
| Logarithmic | f(x) = logₐ(x) | Inverse of exponential | Slowly rising curve |
| Trigonometric | f(x) = sin(x) | Repeating/cyclic | Wave pattern |
Where Functions Actually Show Up
Functions aren't just abstract math exercises. They model real situations constantly.
- Physics: Distance = rate × time is a function. Velocity as a function of time under constant acceleration.
- Finance: Compound interest is f(t) = P(1 + r)ᵗ. Monthly loan payments are functions of principal, rate, and term.
- Computer programming: Functions in code work exactly like mathematical functions — same input, same output, every time.
- Data science: Machine learning models are essentially extremely complex functions that map inputs to predicted outputs.
Getting Started: Writing Your First Functions
Here's a step-by-step process for writing functions from real situations:
- Identify the variables. Which quantity depends on which? The dependent variable becomes your output f(x). The independent variable is x.
- Find the relationship. How does changing the input affect the output? Look for patterns, rates, or formulas that connect them.
- Write the formula. Express that relationship using mathematical notation.
- Test it. Plug in known values and verify the output matches your expectations.
Practice problem: A gym membership costs $50 per month plus a $100 one-time registration fee. Write a function for the total cost after n months.
Answer: cost(n) = 50n + 100
Check: After 3 months, cost(3) = 50(3) + 100 = 250. That's $150 in monthly fees plus the $100 registration. Correct.
Common Mistakes That Will Mess You Up
- Confusing f(x) with multiplication. It's notation, not multiplication. f(x) ≠ f × x.
- Ignoring domain restrictions. Always ask what values x cannot be.
- Swapping composition order. f(g(x)) ≠ g(f(x)) in most cases.
- Forgetting to distribute. 2(3x + 5) = 6x + 10, not 6x + 5.
- Mixing up linear and quadratic behavior. Linear means straight line. Quadratic means curved.
Final Take
Functions are just formalized relationships. The notation looks intimidating at first, but it's just shorthand for "do this operation to that input." Master the basics — linear, quadratic, exponential — and you can tackle most problems you'll encounter. The rest is building from those foundations.