# 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?

## closed as off-topic by Sjoerd C. de Vries, Oleksandr R., bbgodfrey, Dr. belisarius, Daniel LichtblauMay 1 '15 at 14:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Sjoerd C. de Vries, Oleksandr R., bbgodfrey, Dr. belisarius, Daniel Lichtblau
If this question can be reworded to fit the rules in the help center, please edit the question.

• 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}};