practicecalculus
Algebraic functions

Linear Function f(x) = mx + b: Graph, Slope, Derivative and Integral

The linear function f(x) = mx + b: slope and intercept, its straight-line graph, why its derivative is the slope m, its integral and worked examples.

Algebraic functions Updated 3 min read

At a glance

f(x) = mx + b
Domain
(-\infty, \infty)
Range
(-\infty, \infty) if m \ne 0
Derivative
m
Integral
\frac{m}{2}x^2 + bx + C
Slope
m = \frac{y_2 - y_1}{x_2 - x_1}
y-intercept
(0, b)
On this page
  1. Formula and forms
  2. Graph of a linear function
  3. Derivative of a linear function
  4. Integral of a linear function
  5. Worked examples
  6. Common mistakes
  7. How it connects

A linear function has a constant rate of change, so its graph is a straight line. Written f(x) = mx + b, the number m is the slope (how much f rises per unit of x) and b is the y-intercept (the output at x = 0).

Formula and forms

f(x) = mx + b

The same line can be written in other ways, depending on what you know:

Form Equation Use it when you know
Slope-intercept y = mx + b the slope and y-intercept
Point-slope y - y_1 = m(x - x_1) the slope and one point
Standard Ax + By = C an equation to rearrange

Point-slope form is the one calculus uses most, because a tangent line is built from a point (a, f(a)) and a slope f'(a).

Graph of a linear function

Graph of the linear functions y = 2x + 1 and y = -0.5x + 3
A positive slope rises left to right and a negative slope falls. Each line crosses the y-axis at its intercept b.
  • m > 0: increasing. m < 0: decreasing. m = 0: a horizontal line, the constant function.
  • The larger |m| is, the steeper the line.
  • The x-intercept is where mx + b = 0, that is x = -\frac{b}{m} when m \ne 0.

Derivative of a linear function

\frac{d}{dx}(mx + b) = m

The derivative of mx is m by the power rule and constant multiple rule, and the derivative of b is 0. This matches the geometry: the tangent line to a line is the line itself, and its slope never changes. The second derivative is 0, so a line has no concavity.

Integral of a linear function

\int (mx + b)\,dx = \frac{m}{2}x^2 + bx + C

Integrating a line gives a quadratic function. For a definite integral over [a, b], the region under a line is a trapezoid (or two triangles if it crosses the axis), so you can check any answer with geometry.

Worked examples

Example 1: slope from two points. Find the line through (1, 3) and (4, 9).

m = \frac{9 - 3}{4 - 1} = 2, \qquad y - 3 = 2(x - 1) \;\Rightarrow\; y = 2x + 1

Example 2: derivative. If f(x) = -4x + 7, then f'(x) = -4 for every x.

Example 3: definite integral. Evaluate \int_0^2 (3x + 1)\,dx.

\left[\tfrac{3}{2}x^2 + x\right]_0^2 = (6 + 2) - 0 = 8

Check: the region is a trapezoid with parallel sides f(0) = 1 and f(2) = 7 and width 2, so its area is \frac{1 + 7}{2} \cdot 2 = 8.

Example 4: a tangent line. The tangent line to y = x^2 at x = 3 has slope 2(3) = 6 and passes through (3, 9), so it is the linear function y = 6x - 9.

Common mistakes

  1. Swapping the order in the slope formula. Keep the same point first on top and bottom: \frac{y_2 - y_1}{x_2 - x_1}, not \frac{y_2 - y_1}{x_1 - x_2}.
  2. Calling f(x) = x^2 + 1 linear. Linear means the variable appears only to the first power.
  3. Integrating mx as mx^2. The reverse power rule divides by the new exponent: \int mx\,dx = \frac{m}{2}x^2 + C.
  4. Confusing "linear function" with "linear equation in two unknowns". A vertical line x = 2 is a linear equation but not a function.

How it connects

Lines are the reason derivatives exist: the derivative at a point is the slope of the best line through it. That idea powers tangent lines, linear approximation and Newton's method. Lines are degree-one polynomial functions, and integrating them leads to quadratics.

Practice it now

Slope and rate of change

Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.

Practice this lesson

Frequently asked questions

What is the derivative of a linear function?

The derivative of f(x) = mx + b is f'(x) = m, the slope of the line. A line rises by the same amount for every unit step in x, so its rate of change is constant.

What is the integral of mx + b?

The integral is \int (mx + b)\,dx = \frac{m}{2}x^2 + bx + C. You can check it by differentiating: the derivative of \frac{m}{2}x^2 + bx is mx + b.

How do you find the slope of a linear function from two points?

Use m = \frac{y_2 - y_1}{x_2 - x_1}. For the points (1, 3) and (4, 9) the slope is \frac{9 - 3}{4 - 1} = 2.

Is a horizontal line a linear function?

Yes. A horizontal line y = b is a linear function with slope m = 0, which is also a constant function. A vertical line x = a is not a function at all.

Written by the PracticeCalculus team

We build interactive calculus lessons and write every page to be clear and correct. Spotted something off? Tell us and we will fix it.