Linear Function

A linear function is each function that can be expressed in the form

f(x) = mx + c, where m, c ∈ ℝ.

Why m and why c? The m is probably for multiplier and c for constant. Some examples of linear functions:

  • f1(x) = 3x + 2 thus m = 3 and c = 2.
  • f2(x) = 7x thus m = 7 and c = 0.
  • f3(x) = 42 thus m = 0 and c = 42.
  • f4(x) = 0 thus m = 0 and c = 0.

A graph of each linear function forms a straight line. The line has certain properties based on the value of constants m and c.

If m = 0 then the linear function is actually a constant function and the graph is a straight horizontal line that intersects the vertical axis in the point c. Let’s take for an example the function f(x) = 2. The constant m is equal to zero a the constant c is equal to two. Thus the graph is horizontal line that intersects the vertical axis in the point two:

Graph of f(x)=2

If c = 0 then the line always goes through the origin of the graph. The origin is the point (0, 0). Why? Because the function is of the form f(x) = mx for some real number m. And if we take a zero as a input of this function we always get the output zero because m · 0 = 0 regardless of the actual value of m. Thus the coordinates (0, f(0)) = (0, 0) are always included in the graph. Example: f(x) = 2x.

Graph of f(x)=2x

If m ≠ 0 and c ≠ 0 then the line is not horizontal and it doesn’t intersects the origin. But the line intersects the vertical axis in the point c. Why? Because for an input x = 0 we always get the output f(0) = m · 0 + c = c. Example:

f(x) = \frac{x}{5}+2.

The graph, which intersects the vertical axis in point 2, follows:

Graph of f(x)=5/x+2

The Slope of a Linear Function

The slope (or sometimes the gradient) describes the steepness and the direction of the line representing the linear function. Look back at the two previous functions: clearly the function f(x) = 2x is more steep than the f(x) = x/5 + 2 function. What is the reason for it?

Well, it’s the m constant. The greater the constant m is, the steeper the line is. Take a look at a few examples:

Graph of f(x)=x/2 Graph of f(x)=2x Graph of f(x)=8x

The last function with m = 8 is steeper than the second function with m = 2 etc. But it’s not only about the steepness, it’s also about the direction. Look what will happen when we choose negative m:

Graph of f(x)=-x/2 Graph of f(x)=-2x Graph of f(x)=-8x

The line changes its direction. So a line with a positive slope slants upward to the right, a line with a negative slope slants downward to the right. Is it possible to compute the slope knowing only the line, i. e. without the function definition? Yes, it is! Look at this graph:

Slope of a function

We have a straight line that goes through two points (x1, y1) and (x2, y2). We can compute the slope m as the ratio of the “vertical change” to the “horizontal change” between two given points. See formula:

m=\frac{y_2-y_1}{x_2-x_1}.

Basic Properties of Linear Functions

  • The Domain of a linear function is always the whole set of real numbers.
  • The Image of a linear function depends on the m constants.
    • if m = 0 then the image is equal to {c}. In this case the linear function degenerates to a simple constant function, e. g. f(x) = 10. The set of all outputs is just the single number 10, the c constant.
    • if m ≠ 0 then the image is equal to the whole set of real numbers.
  • Graph of each linear function intersects the vertical axis in the point (0, c). We can derive it from the definition. Each linear function has form f(x) = mx + c. Now we take as an input x = 0. We’ll get f(0) = m · 0 + c which clearly equals c. Thus we have input 0 and output c, meaning the line goes through the point (0, c).

Exercises

Exercise 1: Suppose the function f is linear and you know two points of its graph: (0, − 1) and (2, 5). Find the definition of this function. Since we know the two points of the graph and we know that the graph is a straight line, we can draw the graph:

Graph of function f(x)=3x-1

We see that the line intersects the vertical axis in point (0, − 1). Thus the c constant must be equal to − 1.

Now we know the function is of the form f(x) = mx − 1 We also know that f(2) = 5. We can substitute x for 2 and we get: f(2) = 2m − 1 = 5. From this simple equation

2m − 1 = 5

we can compute the value of m:

2m = 6

and then

m = 3.

So the full formula is f(x) = 3x − 1.

Exercise 2: The line goes through points (2, 2) and (6, 4). Find the corresponding linear function.

First, we compute the slope. We just use the basic formula:

m=\frac{y_2-y_1}{x_2-x_1}.

We substitute the coordinates:

m=\frac{4-2}{6-2}=\frac24=\frac12

The slope is equal to ½. Now we know that the linear function has the form f(x) = ½x + c. Let’s find the c value. We know that for input x = 6 the output must be equal to 4 since the point (6, 4) is part of the graph. Thus we know that this holds:

f(6) = ½ · 6 + c = 4.

We simplify the equation little bit

f(6) = 3 + c = 4.

From which we can see that c = 1. The full equation is f(x) = ½x + 1. The graph follows.

The graph of linear function f(x)=x/2+1

Exercise 3: The line goes through points (2, 1) and (2, 3). Find the definition of such linear function.

Again, we compute a slope first:

m = \frac{3-1}{2-2} = \frac{2}{0}.

Wait, what?! We’ve just divided by zero, what the hell? That doesn’t seem right, does it? The point is that this line is a vertical line that cannot describe any function. The “function” returns for input 2 the output 1 and 3 and that’s impossible. Each function must return for an input just one output. It cannot return two different outputs. Look at the graph:

Not a function

This is not the graph of a function.