# How to find the equation of a line which passes through 10 known points

I know how to find the equation of a line which passes through two known points. But here, I have 10 points $(x,y)$ through which my line passes through. I know I can draw a graph and find then find the equation of the line, but is there a better way or online tool to do the task? The values are given below • Will not be possible in general. Look up linear regression. – Parcly Taxel Dec 7 '17 at 12:12
• Side note, if your line is a straight line it certainly does NOT pass through ALL the points you just mentioned... – Gaurang Tandon Dec 7 '17 at 12:36
• if it does not have to be a straight line, look up polynomial interpolation – Vasya Dec 7 '17 at 12:39
• Well, assume a line exists, draw a line through any 2 distinct of them and it will pass through the remaining points. Otherwise the line just doesn't exists. – user202729 Dec 7 '17 at 13:01
• As Parcly Taxel commented, this is related to data regression. Depending on the criteria, you will find the "best" linear approximation for this specific criteria. The problem is that, plotting the data, I cannot see something as a straight line. – Claude Leibovici Dec 7 '17 at 13:05

## 2 Answers

If all 10 points lie along a line, then you can pick any two points, find the equation for the line through those, and that line will pass through the other eight points. This is because "two points determine a line."

You should know, though, that 10 arbitrarily chosen points don't necessarily all lie along a line. Indeed the points in your question do not lie along a line: You can get a line that approximates the points as nearly as possible by "linear regression". In R, you can get the intercept and slope of the regression line with the lm function (for "linear model"):

> mydata = read.csv("~/tmp/known-points.csv")
> lm(mydata)

Call:
lm(formula = mydata)

Coefficients:
(Intercept)          ADC
17.29737      0.07425

• This is exactly what I was looking for. I used regression plug-in in excel and it did the same job. Thanks!! – Aswinth Raj Dec 8 '17 at 12:30

It's a simple Linear Regression problem, take a look here:

https://onlinecourses.science.psu.edu/stat501/node/250