Mathlean · Online math workspace

Linear regression calculator

Fit a straight line to paired data using least squares.

How to use this calculator

Edit the x and y lists. The returned tuple is (intercept,slope); the starter returns (0,2).

Tap the math below to edit it and see the result. Once a result is ready, press Tab on a hardware keyboard to accept it. Outside a matrix, Return completes the line; the phone math keyboard has the same Return action.

Try it here

LinearRegression⁡([1,2,3],[2,4,6])\operatorname{LinearRegression}\left([1,2,3],[2,4,6]\right)

Interactive tools require JavaScript. You can read the guide and example without it.

What to know

This is a linear fit, not a significance test or prediction interval. Check residuals and model assumptions.

Mathlean combines visual mathematical input with computation and canvas tools. Results depend on the expression and available engine support; check important answers independently.

Browse all calculators and editors