Functions can be grouped together in different ways.
If some functions belong to the same group, then that means we’ve noticed a pattern among those functions. This is useful because we can use these patterns to help us work with problems we haven’t seen before.
Today we’ll be looking at functions that are linear. Linear functions themselves are built on two properties known as homogenity and additivity - each interesting in its own right. Then, we’ll be ready to take a look at linear functions and why they’re so special.
Building Blocks
The names of the following properties may sound fancy, but the ideas behind them should be familiar. They have their roots in multiplication and addition.
Homogenity
If a function’s output scales consistently with its input, we call that function homogenous.
Here’s the definition:
$$ f(\alpha x) = \alpha f(x) $$
When we multiply our function’s input by some number $\alpha$ (alpha), we multiply our output by the same amount.
Doubling the input doubles the output. Triple the input, and you get triple the output.
Examples:
- $ f(x) = 3x $
- $ g(x,y) = 3x + 4y $
Imagine if we doubled its inputs:
Additivity
Let’s say you have two inputs, $x$ and $y$, and you want their combined output. There are two ways we can do this.
- Combine the inputs first, and then find their output. This gives us $ f(x + y)$.
- Find the outputs for each input separately, and then combine the results. We get $f(x) + f(y)$.
In general, the two methods will give us different results. (Take any polynomial, for example.) However, if we do get the same results, that means this function is additive.
The definition:
$$ f(x + y) = f(x) + f(y) $$
This takes the results of the two scenarios we described above, and declares them equal.
Examples:
- $ f(x) = 2x $
- $ g(x,y) = 3x + 4y $
- Let’s add $w$ to $x$ and $z$ to $y$.
Remember…
Keep in mind a homogenous or additive function must satisfy its respective property for all inputs. We cannot find just one input that satisfies the condition - it must be satisfied for all possible inputs.
Linear Functions
A linear function is a function that is both homogenous and additive.
The definition:
$$ f(\alpha x + \beta y) = \alpha f(x) + \beta f(y) $$
I mentioned earlier that linear functions are special - here’s why:
Linear functions let us determine the output of a function, even if we do not know what that function is! All we need is a few data points to get started.
Imagine we have the following function: $$f(x)$$
But we don’t know anything about it, except for these three facts:
- This function is linear.
- $f(3) = 9$
- $f(7) = 21$
Believe it or not, this is enough information to find the function’s output for many different inputs.
Let’s take some examples to illustrate.
By homogenity:
$$ f(6) = f(2 * 3) = 2 * f(3) = 2 * 9 $$
By additivity:
$$ f(10) = f(3 + 7) = f(3) + f(7) = 9 + 21 $$
Together:
In fact, we can find the output for any possible input $x$. That is because no matter what $x$ is, we can reformulate it into some combination of $3$’s and $7$’s, which are known values.
However, finding that right combination may take some work, especially for numbers that are large, or have lots of digits after the decimal.
A simpler method is to find the value of $f(1)$, and use that in our calculations.
After all, for any value $x$, we have:
$$ f(x) = x * f(1) $$
Thinking Ahead…
You may have noticed that only one data point was necessary to figure out the value of any other input. This was because our function only took one argument, $x$.
If our function took in a pair of inputs, such as $x$ and $y$, we would need at least two points! This idea of “minimum number of necessary points” is explored further in a linear algebra class, if you’re interested.
Conclusion
Linearity is a useful property to have. There are entire fields that specialize in solving problems that involve linearity, such as linear algebra and linear programming.
I hope this blog post helps you recognize a linear function next time you see one.
That’s all from me, thanks for reading!