How to find a line of best fit with Desmos
To find a line of best fit with Desmos, enter the x-values and y-values as separate lists, then type `Y ~ mX + b`. Desmos calculates the slope and intercept. Plot the points to check the data, and be cautious about predictions far beyond the table’s values.
Updated

Enter the data table as two lists
When a question gives you paired x- and y-values, Desmos can calculate a line of best fit from the numbers. This is usually faster and more exact than estimating the line from a graph. Keep each x-value paired with the y-value from the same row of the table.
Type the x-values as a list named X, then type the y-values as a list named Y on the next line. For example, the x-list could be `[1, 2, 3, 4, 5]`, and the matching y-list could be `[3, 5, 6, 9, 10]`. Check that you have not missed or moved a value: mismatched pairs change the result.
Plot the points, then fit the line
After entering both lists, type `(X, Y)` to plot the data points. Then enter `Y ~ mX + b`, using the tilde key. Desmos shows the values of m and b, which are the slope and intercept of the fitted line.
For the example lists, Desmos gives a slope of 1.8 and an intercept of 1.2. The resulting model is `y = 1.8x + 1.2`. The model describes a line fitted to the points; it does not mean every point must lie exactly on that line.
Read the slope and intercept correctly
In the form `y = mx + b`, m is the slope and b is the y-intercept. The slope tells you how much the model’s y-value changes when x increases by one. The intercept is the model’s y-value when x is zero.
Use the values Desmos returns in the model the question asks for. If it asks for a prediction, substitute the requested x-value into the fitted equation. Keep the distinction clear between a data point from the table and a value predicted by the line: a prediction comes from the model, even when there is no matching row in the table.
Check answer choices with data points
You do not always need to calculate a regression. If the question only asks which of several lines fits best, test each candidate against two points from the table first. Substitute each point’s x-value into the candidate equation and see whether its y-value matches the table.
This can quickly rule out a line that misses the data. Do not spend time finding the exact slope and intercept if checking two points is enough to select an answer. If the question asks for the fitted model or a prediction from it, use the lists and regression instead.
Treat predictions outside the data range carefully
A line of best fit is a model of the data you entered. A prediction inside the table’s range of x-values is more reliable than one far outside it. Beyond that range, the line may continue in a way that the observed points do not support.
Before using a predicted value, compare its x-value with the smallest and largest x-values in your table. If it lies far beyond them, report what the line calculates, but do not treat that result as equally dependable.
Practise the steps, not only the final answer
A correct slope or prediction does not always show whether your method is sound. When you practise, write down how you entered the paired data, what regression you used, and how you got from m and b to the answer. If your result is wrong, those steps help you find whether the problem was a list, the model, or the final substitution.
Exam.Harbour can mark a photo, scan, or on-screen version of your written steps step by step, so you can see where the method went wrong rather than only whether the final answer was correct.
Also asked
- What does the tilde mean in Desmos regression?
- The tilde tells Desmos to fit a model to the data. In `Y ~ mX + b`, Desmos uses the values in lists X and Y to find the slope m and intercept b for the line that best fits the points.
- Should I draw a line of best fit by eye?
- If you have a table of values, using Desmos can give you a more exact model than drawing a line by eye. If a question only asks you to choose which of several lines fits best, check the answer choices against two of the data points first.
- Can I trust a prediction from a line of best fit?
- A line gives a model of the data, not a guarantee. A prediction within the range of x-values in your table is more reliable than one far outside that range. Treat a prediction beyond the observed data with care.