A straight line graph connects a fixed starting value to points that increase at a constant rate.

Linear Functions

A linear function is a mathematical rule that produces a constant rate of change between two quantities, in the context of algebra and coordinate geometry. Its equation is usually written y=mx+by = mx + b, where the slope mm gives the rate of change and the yy-intercept bb gives the starting value. The graph of a linear function is a straight line. Linear functions exist because many useful relationships can be described, or closely estimated, by adding the same amount whenever an input increases by one unit.

What a linear function actually is

A linear function assigns exactly one output to each allowed input and changes its output by a constant amount over equal input intervals. In the coordinate plane, that constant change makes all of its points lie on one straight, nonvertical line.

A function is a rule connecting an input, usually called xx, to one output, usually called yy. If x=3x=3 produces y=11y=11, the ordered pair (3,11)(3,11) records that input and output together. A collection of such pairs is linear when the output differences stay proportional to the input differences.

Consider f(x)=2x+5f(x)=2x+5. Starting with an input of zero gives an output of five. Increasing the input by one always adds two to the output:

Input xxCalculationOutput f(x)f(x)Change in output
02(0)+52(0)+55
12(1)+52(1)+57+2+2
22(2)+52(2)+59+2+2
32(3)+52(3)+511+2+2

The same pattern works between any two inputs, not only consecutive whole numbers. If the input rises by 0.50.5, the output rises by 2(0.5)=12(0.5)=1. If the input falls by four, the output falls by eight. This fixed ratio is what makes the relation linear.

Constant rate test: a function is linear if f(x2)f(x1)x2x1\frac{f(x_2)-f(x_1)}{x_2-x_1} has the same value for every pair of distinct inputs in its domain.

The word linear sometimes gets used more narrowly in advanced mathematics, where a truly linear map must send zero to zero. School algebra usually includes equations such as y=2x+5y=2x+5 under the name linear functions, even though mathematicians may call them affine functions. On this page, the standard school meaning applies.

How slope and intercept work together

Slope controls how much the output changes per unit of input, while the intercept sets the output when the input is zero. Together they fix one and only one nonvertical line, expressed by the slope intercept form y=mx+by=mx+b.

Slope intercept form y=mx+by=mx+b

For y=3x4y=3x-4, the slope is 33 and the vertical intercept is 4-4.

The coefficient mm is a rate with units. In a taxi model where xx is distance in kilometres and yy is total price in dollars, a slope of 2.502.50 means 2.50 dollars per kilometre. The intercept bb has the output's units, dollars in this case, and represents the fare before any distance is travelled.

m>0m>0
The line rises as input increases
m<0m<0
The line falls as input increases
m=0m=0
The output stays constant

The size of the slope measures steepness only after the axis scales and units are known. A slope of 1010 is not automatically steep on a graph whose vertical tick marks count by thousands. Changing kilometres to metres also multiplies a numerical rate by a conversion factor without changing the physical relationship.

The intercept is a starting value only when zero is a meaningful input. In a model of adult height against age, the fitted vertical intercept might be the height predicted at age zero, far outside the ages used to build the model. It still positions the line algebraically, but it should not be treated as a sensible measurement.

How to build a linear equation from information

A linear equation can be built by identifying a constant rate and one known input output pair. Calculate the slope first, substitute the known point into y=mx+by=mx+b to find the intercept, then check the finished rule against the original information.

1
Name the quantities and units

Decide what the input and output measure. This prevents a rate such as dollars per hour from being reversed into hours per dollar.

2
Find the slope

For two points, divide the change in output by the change in input: m=y2y1x2x1m=\frac{y_2-y_1}{x_2-x_1}.

3
Find the intercept

Put one point and the slope into y=mx+by=mx+b, then solve for bb.

4
Test another point

Substitute the other known pair. Matching it catches sign errors and reversed subtraction.

Suppose a water tank contains 620 litres at 9:00 and 500 litres at 11:00 while a pump drains it steadily. Let tt be hours after 9:00 and VV be litres. The two points are (0,620)(0,620) and (2,500)(2,500).

Rate of change in tank volume m=50062020=1202=60 litres per hourm=\frac{500-620}{2-0}=\frac{-120}{2}=-60\text{ litres per hour}

Since V=620V=620 when t=0t=0, the equation is V=60t+620V=-60t+620.

The negative slope matches the physical action: the tank is losing water. At 11:00, t=2t=2, so the equation gives V=60(2)+620=500V=-60(2)+620=500. It passes the check. Setting V=0V=0 also predicts when the tank empties: 0=60t+6200=-60t+620, so t=62060=1013t=\frac{620}{60}=10\frac{1}{3} hours after 9:00, provided the steady rate continues.

If the wording gives a starting amount and a per unit change directly, less work is needed. A 40 dollar service fee plus 18 dollars per hour translates to C=18h+40C=18h+40. This is closely related to the constant multiplier reasoning developed in how ratios and proportions connect quantities, with an added starting value.

How a graph, table, equation, and description represent the same rule

A graph, a table, an equation, and a verbal description can encode the same linear function. Each form emphasizes different information: graphs show overall direction, tables show selected pairs, equations allow calculation, and descriptions supply meaning and units.

Situation and units
Equation
Table of points
Straight line graph

Take a candle that begins 24 centimetres tall and burns down by 1.5 centimetres each hour. The description gives an initial height of 24 centimetres and a rate of 1.5-1.5 centimetres per hour. With time tt and height HH, the equation is H=241.5tH=24-1.5t.

A table might list (0,24)(0,24), (4,18)(4,18), (8,12)(8,12), and (12,6)(12,6). Plotting those points gives a descending straight line. The plotted segment should stop at the point where the candle reaches zero, because negative candle height has no meaning here. The algebraic rule accepts more inputs, but the physical model does not.

Moving between representations is more than a classroom conversion exercise. A manager may receive costs in a table, see a trend on a chart, and need an equation for a budget. A scientist may begin with a proposed equation and graph residuals to test whether it describes measurements adequately. The form changes, while the relation between the quantities stays the same.

How to recover an equation from a graph

Choose two clear points whose coordinates can be read accurately. Compute rise divided by run to get mm. Then read the vertical intercept if it is visible, or substitute either point into y=mx+by=mx+b to solve for bb. Do not estimate slope from the visual angle alone, since axis scales can differ.

Graphing also exposes impossible interpretations. If a quantity cannot be negative, the meaningful part of the graph must remain on or above the horizontal axis. If time is recorded only after an event begins, negative inputs are excluded. A correct equation can still be used incorrectly when its domain is ignored.

Linear functions versus proportional relationships

A proportional relationship is a special linear function with a zero intercept, so its equation has the form y=kxy=kx and its graph passes through the origin. A general linear function may include a nonzero fixed starting amount bb.

Proportional relationship

y=4xy=4x. Zero items cost zero dollars, and doubling the number of items doubles the total cost. The graph passes through (0,0)(0,0).

Linear but not proportional

y=4x+7y=4x+7. A fixed 7 dollar charge remains when the item count is zero. Doubling the item count does not double the whole total.

The distinction matters whenever a fixed fee, baseline measurement, or initial stock is present. A gym bill with a joining fee and a monthly charge is linear over a suitable period, but it is not proportional. A car travelling at constant speed from a location 20 kilometres east of a marker has position p=vt+20p=vt+20; its position is linear in time but not proportional to time.

One quick test is to evaluate the rule at zero. If f(0)=0f(0)=0, a linear function is proportional. If f(0)0f(0)\ne0, it is not. Another test is to compare yx\frac{y}{x} for nonzero inputs. That quotient stays constant for proportional relationships, but not for lines with nonzero intercepts.

Linear functions versus nonlinear functions

A linear function has one constant slope, while a nonlinear function changes rate or direction. Equal steps in input produce equal output changes only in the linear case; curved graphs, variable first differences, products of variables, and powers such as x2x^2 signal nonlinearity.

Compare f(x)=3x+1f(x)=3x+1 with g(x)=x2+1g(x)=x^2+1. For inputs 0, 1, 2, and 3, the outputs of ff are 1, 4, 7, and 10. Their first differences are always 3. The outputs of gg are 1, 2, 5, and 10. Their first differences are 1, 3, and 5, so the rate is changing.

The graph of g(x)=x2+1g(x)=x^2+1 bends because its slope is not fixed. This is the kind of changing rate studied through equations whose graphs form parabolas. Exponential functions change by equal factors over equal input steps, while linear functions change by equal amounts. That difference separates steady addition from repeated multiplication.

A line of best fit is still a model. Real data points do not need to sit exactly on one line for a linear approximation to be useful, but the departures from the line must be examined before trusting predictions.

A curved process can look almost linear across a short interval. The surface of Earth, for example, looks flat over a small patch even though Earth is not flat. In the same way, a changing relationship may be approximated with a tangent line or a fitted line over a restricted range. The approximation is useful only while its error remains acceptable for the decision being made.

How linear functions show up in money, work, and measurement

Linear functions appear when a total combines a fixed amount with a constant charge, earning rate, conversion factor, or steady change. They model wages, simple pricing plans, unit conversions, depreciation estimates, inventory movement, and many short range physical processes.

Real-world scenario

A freelance repair technician charges a 55 dollar visit fee and 32 dollars for each half hour of labour. If nn counts half hour blocks, the labour bill is C=32n+55C=32n+55. Three blocks cost C=32(3)+55=151C=32(3)+55=151 dollars.

The equation separates two business facts. The slope is the charge for each additional block. The intercept is the charge that does not depend on the number of blocks. A competing technician with equation C=38n+25C=38n+25 starts cheaper but rises faster. Set the bills equal to find the break even job length:

Break even point 32n+55=38n+2530=6nn=532n+55=38n+25 \quad\Rightarrow\quad 30=6n \quad\Rightarrow\quad n=5

At five half hour blocks, both bills are 215215 dollars.

Before that point, the second technician costs less; after it, the first does. This is how an intersection of two lines becomes a decision threshold. The same method compares mobile plans, rental offers, manufacturing methods, and any pair of options with fixed and variable costs.

Unit conversion supplies exact linear functions. Celsius temperature CC converts to Fahrenheit temperature FF through F=95C+32F=\frac{9}{5}C+32. The multiplication changes the size of each degree, and the added 32 aligns the two scales' zero points. Because of the offset, temperature conversion between these scales is linear but not proportional.

Some money calculations are only linear under stated assumptions. Straight line depreciation assigns an asset the same loss of book value each year, but market value rarely falls so neatly. Simple interest grows linearly when interest is calculated only on the original principal. Compound interest is nonlinear because each period's interest changes the base used for the next period.

Measurement devices often use a linear calibration over an operating range. A sensor may turn voltage into temperature using a fitted slope and intercept. The technician must check units, calibration limits, and residual error. A line that matches readings between two tested temperatures does not automatically describe behavior outside those temperatures.

4 mistakes people make with linear functions

Most errors with linear functions come from confusing a rate with a starting value, reversing the slope calculation, ignoring units or domain, or assuming any visible trend must continue. Each mistake changes the meaning of the equation, not only its arithmetic.

1. Reversing rise and run

Slope is output change divided by input change. If xx is time in hours and yy is distance in kilometres, ΔyΔx\frac{\Delta y}{\Delta x} has units of kilometres per hour. Reversing it gives hours per kilometre, which is a different rate.

Subtraction order may be chosen either way, but it must stay consistent. For points (2,7)(2,7) and (5,19)(5,19), 19752=4\frac{19-7}{5-2}=4. Reversing both differences gives 71925=4\frac{7-19}{2-5}=4 as well. Reversing only one produces the wrong sign.

2. Treating the intercept as the slope

In y=6x+40y=6x+40, 6 is the per unit change and 40 is the output at zero. The intercept does not tell how fast the output changes. Labeling units makes the roles visible: 6 might be dollars per ticket, while 40 is dollars.

3. Ignoring the meaningful domain

A formula may accept inputs that the situation forbids. If C=12n+8C=12n+8 models a delivery containing nn boxes, negative values and fractional boxes may be invalid. The practical domain could be whole numbers beginning at zero, even though the drawn line contains every real input.

4. Extending the line without evidence

A steady pattern inside observed data does not guarantee the same pattern forever. A worker paid hourly may reach an overtime threshold. A tank stops draining once empty. A subscription may change price. Extrapolation assumes that the mechanism stays constant, so the assumption must be defended.

“A straight line is a claim that the same input change keeps producing the same output change.”

This sentence is a useful check before writing an equation. Ask what physical, financial, or procedural mechanism keeps the rate fixed. If there is no such mechanism, the line may still summarize a narrow range, but it should not be mistaken for a permanent law.

How vertical and horizontal lines fit the picture

A horizontal line is a linear function with slope zero, while a vertical line is not a function of xx. The difference comes from output assignment: a vertical line gives one input many outputs, violating the definition of a function.

The equation y=5y=5 assigns the output 5 to every input. Its graph is horizontal, its slope is zero, and it fits y=mx+by=mx+b with m=0m=0 and b=5b=5. A constant function is therefore linear in the school algebra sense.

The equation x=5x=5 includes every point whose horizontal coordinate is 5. One input is paired with many possible yy values, so it fails the vertical line test. Its slope would require division by zero, which is undefined. The line is straight, but it is not a function of xx.

What domain, range, zeros, and intersections tell you

Domain lists allowed inputs, range lists possible outputs, a zero marks where the output is zero, and an intersection marks where two relations have the same input and output. These features translate algebraic points into limits, thresholds, and comparisons.

For f(x)=4x12f(x)=4x-12, solve 4x12=04x-12=0 to get the zero x=3x=3. The graph crosses the horizontal axis at (3,0)(3,0). Depending on context, that point might mean a debt is repaid, a reservoir is empty, or profit moves from negative to positive.

A nonconstant linear function with all real inputs also has all real outputs. A real situation usually narrows both sets. If a machine fills containers for no more than eight hours, the domain might be 0t80\le t\le8. The range then comes from evaluating the line at those boundary inputs, with direction determined by the sign of the slope.

Intersections solve systems. If income is R=15qR=15q and cost is C=9q+120C=9q+120, equality gives 15q=9q+12015q=9q+120, so q=20q=20. At 20 units, both totals are 300 dollars. Below that quantity cost exceeds income; above it income exceeds cost.

How interpolation and extrapolation use a line

Interpolation estimates between known inputs, while extrapolation predicts beyond them. A linear model can do both by substituting a new input, but interpolation is usually safer because extrapolation assumes the same rate continues into an unobserved region.

Suppose a container holds 18 litres at two minutes and 42 litres at six minutes while filling steadily. The slope is 421862=6\frac{42-18}{6-2}=6 litres per minute. Substituting (2,18)(2,18) gives V=6t+6V=6t+6. Estimating the volume at four minutes is interpolation: V=6(4)+6=30V=6(4)+6=30 litres.

Predicting the volume at twenty minutes is extrapolation. The equation gives 126 litres, but that answer is useful only if the container has enough capacity and the filling rate remains fixed. The arithmetic is correct under the model. The prediction may still be physically false.

Inside the measured interval

Interpolation uses nearby evidence on both sides of the estimate. A straight line may still be imperfect, but the estimate stays within tested conditions.

Outside the measured interval

Extrapolation has evidence on only one side. Capacity limits, changing rates, and new rules can make the continued line fail.

Data may also contain decimals that need careful interpretation before fitting or reading a line. The techniques in working accurately with fractional and decimal values help preserve units and avoid rounding too early. Keep extra precision during the calculation, then round the final result to a level supported by the measurements.

A linear model turns constant change into a usable prediction

Linear functions connect algebra to observable change by pairing a starting value with a constant rate. They let you calculate missing values, compare options, locate thresholds, and test whether a straight line is a defensible model for a real process.

The habit to keep is simple: name the quantities, attach units, locate the starting value, and ask what makes the rate constant. Then test the equation against known points and restrict it to inputs the situation permits. These checks turn symbols into an accountable description of what is happening.

The takeaway: read y=mx+by=mx+b as a mechanism. Begin at bb, add mm for each one unit increase in xx, and stop trusting the rule when the constant rate assumption stops matching reality.

Linear functions sit near the entrance to algebra because the same ideas lead onward to systems, inequalities, data models, and calculus. To place this topic beside those connections, see how the mathematics guides fit together. Then notice one changing quantity today and ask whether equal input steps really produce equal output changes.

Related across Lelfy