# 3: Linear Regression

$$\newcommand{\vecs}{\overset { \rightharpoonup} {\mathbf{#1}} }$$ $$\newcommand{\vecd}{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$$$\newcommand{\AA}{\unicode[.8,0]{x212B}}$$

Quick review of equations for lines:

Recall the equation of a line is usually in the form $$y = mx + b$$, where $$x$$ and $$y$$ are variables and m and b are numbers. Some basic facts about lines:

• If you are given a number for x, you can plug it in to the equation $$y=mx+b$$ to get a number for $$y$$, which together give you a point with coordinates (x, y) that is on the line.
• m is the slope, which tells how much the line goes up (increasing y) for every unit you move over to the right (increasing x) – we often say that the value of the slope is $$\ m=\frac{rise}{run}$$.
• positive, if the line is tilted up,
• negative, if the line is tilted down,
• zero, if the line is horizontal, and
• undefined, if the line is vertical.
• You can calculate the slope by finding the coordinates (x1, y1) and (x2, y2) of any y2 −y1 two points on the line and then $$\ m = \frac{y_2 - y_1}{x_2 - x_1}$$.
• In particular, x2−x1=1,then $$\ m =\frac{y_2 - y_1}{1} = y_2 - y_1$$ - so if you look at how much the line goes up in each step of one unit to the right, that number will be the slope m (and if it goes down, the slope m will simply be negative). In other words, the slope answers the question “for each step to the right, how much does the line increase (or decrease)?”
• b is the y-intercept, which tells the y-coordinate of the point where the line crosses the y-axis. Another way of saying that is that b is the y value of the line when the x is 0.

This page titled 3: Linear Regression is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Jonathan A. Poritz via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.