ThisCalculator

Everyday

Desmos Regression Calculator: How to Use It

Updated · Standard formula, shown below

Average pace 5.00 min/km
Average speed
12.00 km/h
Result
Finish time
50 min
You entered
Distance
10 km
You entered

The Desmos regression calculator is a built-in feature of the Desmos graphing calculator that fits a curve to a set of data points using least-squares regression. You enter your x and y data as a table, add a slider-based expression like y1 ~ m x1 + b, and Desmos instantly computes the best-fit parameters, R² value, and plots the curve. This article explains how to use it, what the output means, and how to avoid common mistakes.

Formula

The regression calculator uses the least-squares method to find parameters that minimize the sum of squared residuals. For a linear model y = mx + b, the formula is:

m = (n Σxy − Σx Σy) / (n Σx² − (Σx)²)

b = (Σy − m Σx) / n

Where:

  • x and y are the data points (units depend on your data)
  • n is the number of points
  • Σ means “sum of”

Desmos also reports R², the coefficient of determination, which tells you how well the model fits (1.0 = perfect fit).

Worked Example

Using the default values from the calculator above: you finished a 10 km run in 50 minutes.

  1. Pace = time / distance = 50 min / 10 km = 5.00 min/km
  2. Speed = distance / (time / 60) = 10 / (50/60) = 12.00 km/h

The calculator shows an average pace of 5.00 min/km and an average speed of 12.00 km/h. This is not a regression example, but it shows how the calculator block works. For regression, you’d enter your data into a table.

How to Use Desmos Regression

Open the Desmos graphing calculator (desmos.com/calculator). Follow these steps:

  1. Click the + button and choose Table.
  2. Enter your x-values in the first column and y-values in the second column. Desmos names them x1 and y1.
  3. Type a new expression using a tilde (~) instead of an equals sign. For example, y1 ~ m x1 + b.
  4. Desmos immediately shows the best-fit values for m and b, plus R². It also draws the line on the graph.

You can use any model: quadratic (y1 ~ a x1² + b x1 + c), exponential (y1 ~ a e^(b x1)), or even a custom function. Just replace the parameters with letters.

Choosing the Right Model

Desmos doesn’t tell you which model to use—you have to choose. Here are common ones:

  • Linear: y1 ~ m x1 + b — for data that follows a straight line.
  • Quadratic: y1 ~ a x1² + b x1 + c — for a parabolic trend.
  • Exponential: y1 ~ a e^(b x1) — for growth/decay.
  • Logarithmic: y1 ~ a + b ln(x1) — for data that levels off.
  • Power: y1 ~ a x1^b — for allometric relationships.

Look at a scatter plot of your data first. If it curves upward, try quadratic or exponential. Compare R² values—higher is generally better, but a complex model can overfit.

Common Problems and Mistakes

Here are the most frequent issues users run into:

  • Using = instead of ~: The tilde tells Desmos to do regression. With an equals sign, it just plots a function.
  • Mismatched column names: If your table is x2 and y2, use y2 ~ m x2 + b. Desmos won’t know what x1 is if you didn’t define it.
  • Not enough data points: You need at least as many points as parameters. For a line, that’s 2 points; for a quadratic, 3.
  • Non-numeric data: Desmos only works with numbers. Check for blank cells or text.
  • Ignoring R²: A low R² means the model doesn’t fit well. Don’t just report the parameters.

Understanding the Output

Desmos shows the best-fit parameters (like m and b) with several decimal places. It also gives R² and the residual sum of squares. The residual plot (if you add one) shows the difference between each data point and the model. If residuals form a pattern, your model is missing something.

R² values range from 0 to 1. A value of 0.95 means 95% of the variation in y is explained by x. But a high R² doesn’t guarantee causation—just correlation.

Limitations and Alternatives

Desmos regression is great for quick classroom or personal use, but it has limits:

  • It doesn’t provide confidence intervals or p-values (inferential statistics).
  • It may struggle with highly nonlinear models or large datasets (thousands of points).
  • It only does least-squares fitting, not robust regression.

For more advanced analysis, use a spreadsheet (Excel, Google Sheets), a statistical package (R, Python), or a dedicated tool like GeoGebra. These offer more diagnostics and control.

Frequently Asked Questions

How do I get Desmos to show the regression equation on the graph?

After you type y1 ~ m x1 + b, Desmos automatically displays the equation with the computed values (e.g., y = 2.5x + 1.3). You can also click the expression to see the full summary, including R² and residuals.

Can I do multiple regression (more than one x variable)?

Yes, but only in the Desmos 3D or with a workaround. In the standard 2D calculator, you can add a second column, say x2, and use y1 ~ a x1 + b x2 + c. Desmos will compute a, b, and c. It won’t plot a plane, but it gives the coefficients.

Why does Desmos give a different answer than Excel?

Both use least-squares, so results should match. Differences may come from rounding, different model forms (e.g., exponential vs. linearized), or missing data. Check that you’re comparing the same model and that Excel isn’t using a different algorithm.

What does the tilde (~) mean in Desmos?

The tilde is Desmos’s regression operator. It tells the calculator to find the best-fit values for the parameters in the expression, rather than plotting a function. It’s specific to Desmos and not standard math notation.

Can I use Desmos regression for non-linear data?

Yes. You can fit exponential, logarithmic, sinusoidal, or any custom model. Just type the equation with parameters and use ~. Desmos will numerically find the best fit, though it may require good initial guesses for complex models.

Is Desmos regression free?

Yes, the Desmos graphing calculator and its regression features are free to use on the web and in the mobile app. You don’t need an account to use the calculator, though an account lets you save your graphs.

Related

Formula used
in t | Finish time | min | 50 | 0
in d | Distance | km | 10 | 0
out pace | Average pace | min/km | t / d | 2
out speed | Average speed | km/h | d / (t / 60) | 2

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.