Skip to main content

Linear Regression Calculator

Calculate linear regression instantly with our math tool. Shows detailed work, formulas used, and multiple solution methods.

Reviewed by Manoj Kumar, Mathematics Educator

Reviewed by Manoj Kumar, Mathematics Educator

Formula

y = mx + b | m = (nฮฃxy - ฮฃxฮฃy) / (nฮฃxยฒ - (ฮฃx)ยฒ) | b = (ฮฃy - mฮฃx) / n

Least squares linear regression finds the best-fit line through data points by minimizing the sum of squared residuals.

Worked Examples

Example 1: Simple dataset

Problem:X: 1,2,3,4,5 and Y: 2,4,5,4,5

Solution:m=(5ร—40-15ร—20)/(5ร—55-225)=0.6, b=(20-0.6ร—15)/5=2.2

Result:y = 0.6x + 2.2, Rยฒ = 0.36

Frequently Asked Questions

What is regression analysis and when should I use it?

Regression models the relationship between a dependent variable and one or more independent variables. Linear regression fits a straight line (y = mx + b). Use it to predict outcomes, identify which variables matter most, and quantify relationships. R-squared tells you what percentage of variation is explained by the model.

Reviewed by Manoj Kumar, Mathematics Educator ยท Editorial policy