MathAnalysisCalculusNumerical functions

Linear functions

8 minutes read

As you may know, graphs of functions come in many different shapes. It is intuitive that functions which graphs look alike share similar properties and behave in a similar manner. So we distinguish different classes of functions based on their graphs. In this topic, we will learn about the basic class of functions – linear functions, which graph is, well, a straight line. Even though they aren't all that complicated, we use them on a daily basis in various situations without knowing it. From Hooke's law in physics or computation of an annual salary to a simple discount in a shop – all these are linear functions. We will learn what properties they have, how their graphs look, and how one can spot them.

Definition and graph

The formal definition states that a linear function f:XYf: X \rightarrow Y has a form: y=f(x)=ax+b,y =f(x) = a \cdot x + b\text{,}where xX,yYx \in X, y \in Y and a,bRa, b \in \mathbb{R}. Pay attention that a function is linear only if xx has the degree of 11. Meanwhile, the value of aa and bb could also be equal to 00. The graph of f(x)=0x+5=5f(x) = 0 \cdot x +5 = 5is a straight line, therefore this function is linear, test it yourself!

As an example consider a function that calculates the age of a person depending on a current year. For example, we know that if a person was born in the year 19881988, then in the year 20072007 he or she would be 20071988=192007 - 1988 = 19 years old. Let's write this as a function where xx is the year: in year xx the person would be f(x)=x1988f(x) = x -1988years old. In this particular linear function aa and bb take values: a=1a = 1 and b=1988b = -1988.

Graph of a linear function

Consider another example. Let's say Bob is a recent graduate, who just got his dream job. Previously, in order to pay for his studies, Bob has borrowed 25000 from a bank, which he now must pay back. Bob's monthly salary is 7000 but after paying all the taxes and bills he is left with 1500. This money goes to repaying Bob's debt. How many months will it take for Bob to completely repay his debt if his salary and expenses stay the same for the whole period? We can express the debt as a function of months that Bob has worked: f(x)f(x). Initial debt is static and is equal to 25000, the monthly payments are 1500, we get: f(x)=1500x25000f(x) = 1500 \cdot x - 25000. Values this function takes correspond to Bob's remaining debt after xx months.

Properties

Now let's take a look at the more complicated properties of linear functions. The first one would be the slope of the line which shows the rate of the function's value change (f(x)f(x) value) in correspondence with the argument's change (xx value). The slope of a function represents the quotient of the difference of values of the function at points x1,x2x_1, x_2 divided by the difference of these points f(x2)f(x1)x2x1f(x_2) - f(x_1) \over x_2 - x_1. To put it simpler: it shows, how fast the function changes at a given interval between arbitrary points x1,x2x_1, x_2. And because the graph of a linear function is a straight line, the slope of such function would be the same for any x1x_1 and x2x_2, i.e. the function changes at a constant rate. If we represent the given linear functions as f(x)=ax+bf(x) = a \cdot x + b and insert this value into our formula, we will get that:

f(x2)f(x1)x2x1f(x_2) - f(x_1) \over x_2 - x_1 == (ax2+b)(ax1+b)x2x1(a \cdot x_2 +b) - (a \cdot x_1 + b) \over x_2 - x_1==a(x2x1)x2x1a \cdot (x_2 - x_1)\over x_2 - x_1== aa – the slope is equal to the coefficient aa.

Also, if a function is not constant, i.e. the value of a0a \neq 0, the graph of this function would cross the xx and yy axis at some point.

A constant function would only cross the yy axis, as its value doesn't change. It will either be equal to 00 In case f(x)=0f(x) = 0 or would never cross the xx axis.

We call such points the xx–intercept and yy–intercept for xx and yy axis respectively. Finding the coordinates of yy–intercept is pretty straightforward: the linear function must take 00 as an argument and the point's coordinates will be (0,f(0))(0, f(0)). The xx–intercept is a bit trickier. we are looking for an argument xx at which the function's value is 00. To find it we must solve the equation f(x)=0f(x) = 0. For a linear function f(x)=2x4f(x) = 2 \cdot x -4 the yy-intercept would be the point (0,4)(0, -4) and to find the xx–intercept we must solve: 2x4=02 \cdot x -4=0;

2x=42 \cdot x=4;

x=2x = 2

So the coordinates of the xx–intercept are (2,0)(2,0).

Graph of a linear function (2)

Linear functions of two or more variables

Up until this point, we have only spoken about the linear functions of one variable. But as you may know, a function may have not only 11, but 2,32 ,3 or nNn \in \mathbb{N} variables. For a function with nn variables to be linear, it must have a constant rate of change with regard to all its variables. What does it mean exactly? Well, consider a function z=f(x,y)Zz = f(x,y) \in Z that depends on two variables: xXx \in X and yYy \in Y, and describes a household's weekly income. There are 22 people in the family – partner1\text{partner}_1 earns 150 dollars per day and partner2\text{partner}_2 who earns 200 dollars per day. The arguments xx and yy show how many days did partner1\text{partner}_1 and partner2\text{partner}_2 work respectively. If both partners worked 5 days each, the family will get f(5,5)=5150+5200=1750f(5,5) = 5 \cdot 150 + 5 \cdot 200 = 1750 dollars. Then, if partner1\text{partner}_1 worked only 44 days, the family would get f(4,5)=4150+5200=1600f(4,5) = 4 \cdot 150 + 5 \cdot 200 = 1600 dollars, and if partner2\text{partner}_2 worked 44 the income would be 15501550 dollars. Now you may wonder, we reduced each argument by one, but got different results in the end, which means that the function has a different rate of change, no? How is it linear? Now, for a multivariable function to be linear we take into account only the change rate with respect to each argument individually, we don't inspect the functions as a whole. If partner1\text{partner}_1 would work only 33 days instead of 44, the result would be less by 150 dollars. If he or she worked 22 days instead of 33 it again would diminish by 150 dollars – the rate of change with respect to the first argument xx stays the same, which is also true for the second argument.

Let's take a look at a non-linear multivariable function. Consider a student Bob who is very lazy. Bob loves staying in bed for many hours and hates going to school. For each schoolday that he misses he should catch up with all the classes and hand in all the missed homeworks. If Bob misses many days in a row, his debt grows and it becomes exponentially harder for him to catch up. Let's say that to do any homework Bob requires 2 hours. And if he misses nn school days he needs n2n^2 hours of work to catch up with the study material. The function f(x,y)f(x,y) calculates, how many hours in total Bob needs to finish all homeworks and catch up with others. The function is calculated as follows: f(x,y)=2x+y2f(x,y) = 2 \cdot x + y^2. The function is linear with respect to the argument xx – its rate of change is constant and isn't linear for argument yy. If Bob misses 11 day, he needs 22 hours to catch up, if he misses 22 days, he needs 44 hours – the rate of change so far is 42214-2 \over 2-1=2=2. But if he misses 33 days, he would need 99 hours and the rate of change would grow to be 94329-4 \over 3-2=5/1=5= 5/1 = 5. So basically you may perceive a multivariable function as a composition of functions with one variable, and each of those functions must be linear for the whole multivariable function to be linear.

Lastly, let's talk about graphs of multivariable linear functions. In the 2D case (function of 11 variable) the graph was a straight line. If the function has 22 variables the graphs lie in 3D space. Now we have 2 sub-functions (with respect to each argument) and their graphs are 22 straight lines, which gives us a plane as a result. Here is the graph of a linear multivariable function z=f(x,y)=3xyz =f(x,y) = 3 \cdot x - y:

Graphic of a linear multivariable function

But if we plot the non-linear function from the previous example: z=f(x,y)=2x+y2z = f(x,y) = 2 \cdot x + y^2. Its graph will be curved:

Graphic of a  nonlinear function

It is important to understand that number of dimensions doesn't change how linear functions behave. You may still find the slope in X,Y,ZX, Y, Z or any other direction as well as corresponding intercepts. If the number of variables in a function is more than 22 we can no longer picture its graph, but we can still describe it as it preserves all properties from 2D and 3D cases.

Conclusion

In this topic, you have learned about one of the simpler and more common classes of functions – linear functions. Let's now quickly go over the main features of this type of function:

  • Graph of a linear function can be represented as a straight line in 2D, or as a plane in 3D space.

  • Linear functions all have the same form: y=f(x)=ax+by =f(x) = a \cdot x + b. Where both the slope and the position of the function depend on parameters aa and bb.

  • We can find a slope of a linear function by using this formula: f(x2)f(x1)x2x1f(x_2) - f(x_1) \over x_2 - x_1.

  • If the rate of change for each variable in a multivariable function is constant on the whole domain that means that our function is linear.

47 learners liked this piece of theory. 6 didn't like it. What about you?
Report a typo