# How to do linear fit for 2D data points [closed]

I am very much new to Mathematica, and facing several difficulties. I used the following code

Fit[{2, 4, 6, 8}, {1, x}, x]


The output is 8.88178*10^-16 + 2. x.

Now I have the following data set.

{0.1,2},{0.12,3},{0.15,4.2},{0.17,5}


How can I fit this data set?

• Also take a look at question 80998 for some discussion of the different fitting functions in Mathematica. – MarcoB May 1 '15 at 8:03
• Really, the very first example on the Fit doc page shows this use case. Although we love to help people out here, we also appreciate it if we see some minimal effort. I don't want to be too harsh on you, but it seems that this minimal effort is lacking here. – Sjoerd C. de Vries May 1 '15 at 11:11

data = {{0.1, 2}, {0.12, 3}, {0.15, 4.2}, {0.17, 5}};