# Linear Relationship: Definition, Formula, and Examples

> **Definition**
>
> Two variables have a linear relationship when they increase and decrease correspondingly.

## What Is a Linear Relationship?

A linear relationship (or linear association) refers to a relationship between two variables that can be represented with a straight line on a [graph](https://www.investopedia.com/terms/l/line-graph.asp). As one variable increases or decreases, the other does so proportionally. This relationship can be visualized graphically or described mathematically using an equation.

Linear relationships are common in statistics, economics, and everyday life. They are often contrasted with nonlinear relationships, where variables relate in more complex or curved ways.

### Key Takeaways

*   A linear relationship, when graphed, creates a straight line.
*   Linear relationships can be expressed either in a graphical format or as a mathematical equation of the form y = mx + b.
*   Linear functions are widely used in economics, physics, finance, and data analysis.
*   A positive slope indicates that both variables increase together; a negative slope means one decreases as the other increases.

![Linear Relationship](https://www.investopedia.com/thmb/lt-3IADMnaa9jDXTuSJFpoBhUAw=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/Linear-Relationship-Final-62ba644838df4724b023c8a8618c0ac6.png)

*Cost and quantity often have a linear relationship: the more of an item you buy, the more you spend. — Investopedia / Yurle Villegas*

## Formula for a Linear Relationship

Mathematically, a linear relationship is one that satisfies the equation:

$\begin{aligned} &y = mx + b \\ &\textbf{where:}\\ &m=\text{slope}\\ &b=\text{y-intercept}\\ \end{aligned}$

In this equation, “x” and “y” are two variables that are related by the parameters “m” and “b”. Graphically, y = mx + b plots in the x-y plane as a line with slope “m” and y-intercept “b.” The y-intercept “b” is simply the value of “y” when x=0. The slope “m” is calculated from any two individual points (x1, y1) and (x2, y2) as:

$m = \frac{(y_2 - y_1)}{(x_2 - x_1)}$

## What Does a Linear Relationship Tell You?

There are three sets of necessary criteria an equation has to meet in order to qualify as a linear one:

*   An equation expressing a linear relationship can't consist of more than two variables
*   All of the variables in an equation must be to the first power
*   The equation must graph as a straight line

A commonly used linear relationship is a [correlation](https://www.investopedia.com/terms/c/correlation.asp), which describes how close to linear fashion one variable changes as related to changes in another variable.

In [econometrics](https://www.investopedia.com/terms/e/econometrics.asp), [linear regression](https://www.investopedia.com/terms/r/regression.asp) is an often-used method of generating linear relationships to explain various phenomena. It is commonly used in extrapolating events from the past to make forecasts for the future. Not all relationships are linear, however. Some data describe relationships that are curved (such as polynomial relationships), while still other data cannot be parameterized.

## Linear Functions

Mathematically similar to a linear relationship is the concept of a linear function. In one variable, a linear function can be written as follows:

$\begin{aligned} &f(x) = mx + b \\ &\textbf{where:}\\ &m=\text{slope}\\ &b=\text{y-intercept}\\ \end{aligned}$

This is identical to the given formula for a linear relationship except that the symbol f(x) is used in place of _y._ This substitution is made to highlight the meaning that x is mapped to f(x), whereas the use of _y_ simply indicates that x and y are two quantities, related by A and B. 

In the study of linear algebra, the properties of linear functions are extensively studied and made rigorous. Given a scalar C and two vectors A and B from R, the most general definition of a linear function states that:

$c \times f(A +B) = c \times f(A) + c \times f(B)$

## Examples of Linear Relationships

### Speed and Distance

Linear relationships are pretty common in daily life. For example, take the concept of speed. The formula used to calculate speed is as follows: the rate of speed is the distance traveled over time. If someone in a minivan is traveling between Sacramento and Marysville in California, a 44.1-mile stretch on Highway 99, and the complete journey takes about 45 minutes, they will have been traveling at just below 60 mph.

While there are more than two variables in this equation, it's still a linear equation because one of the variables will always be a constant (distance).

### Distance = Rate × Time

A linear relationship can also be found in the equation distance = rate x time. Because distance is a positive number (in most cases), this linear relationship would be expressed in the top right quadrant of a graph with an X and Y axes.

If a bicycle made for two was traveling at a rate of 30 miles per hour for 20 hours, the rider would end up traveling 600 miles. Represented graphically with the distance on the Y-axis and time on the X-axis, a line tracking the distance over those 20 hours would travel straight out from the [convergence](https://www.investopedia.com/terms/c/convergence.asp) of the X and Y axes.

### Temperature Conversion

In order to convert Celsius to Fahrenheit, or Fahrenheit to Celsius, you would use the equations below. These equations express a linear relationship on a graph:

﻿ $\degree C = \frac{5}{9}(\degree F - 32)$﻿

﻿ $\degree F = \frac{9}{5}\degree C + 32$﻿

### Real Estate Pricing

Assume that the independent variable is the size of a [house](https://www.investopedia.com/articles/mortages-real-estate/11/the-truth-about-the-real-estate-market.asp) (as measured by square footage), which determines the market price of a home (the dependent variable) when it is multiplied by the slope coefficient of 207.65 and is then added to the constant term $10,500.

If a home's square footage is 1,250, then the market value of the home is (1,250 x 207.65) + $10,500 = $270,062.50. Graphically, and mathematically, it appears as follows:

![Linear Relationship](https://www.investopedia.com/thmb/ye9gbreKQ0_pumFDbuobQYIPP2k=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/LinearRelationshipDefinition2-a62b18ef1633418da1127aa7608b87a2.png)

*The linear relationship between square footage and home price.*

In this example, as the size of the house increases, the [market value](https://www.investopedia.com/terms/m/marketvalue.asp) of the house increases linearly.  

### Proportional Relationships

Some linear relationships between two objects can be called a "proportional relationship." This relationship appears as:

$\begin{aligned} &Y = k \times X \\ &\textbf{where:}\\ &k=\text{constant}\\ &Y, X=\text{proportional quantities}\\ \end{aligned}$

When analyzing behavioral data, there is rarely a perfect linear relationship between variables. However, trend lines can be found in data that form a rough version of a linear relationship. For example, you could look at the daily sales of ice cream and the daily high temperature as the two variables at play in a graph and find a crude linear relationship between the two.  

## What Is a Positive Linear Relationship?

A positive linear relationship is represented by an upward line on a graph. It means that if one variable increases, then the other variable increases. Conversely, a negative linear relationship would show a downward line on a graph. If one variable increases, then the other variable decreases proportionally.

## What Is a Nonlinear Relationship?

A nonlinear relationship can be viewed in scatter plots on a graph. Scatter plots follow a certain pattern, but that pattern is not linear, meaning the representation is not a straight line.

## What Is an Example of a Linear Relationship in Statistics?

An example of a linear relationship would be an hourly-paid worker. The more hours they work, the more money they receive. This relationship would be linear, as every hour worked would correspond to the same increase in pay.

## The Bottom Line

A linear relationship in statistics shows a straight-line relationship between two variables. It typically shows how well two variables correlate with one another. Although no behavioral relationship is perfect enough to generate a true linear relationship, trends are usually found in data to assume one exists.