What did Lagrange, Euler, Gauss etc. learn in order to know what they knew?

What did the great mathematician, like Cauchy, Lagrange, Euler and Gauss, learn in order to know what they knew?

It seems that they were extremely good in the most basic rules/structures/issues of math:
(infinite) series, limits, trigonometry, (geometry?) etc.

1. What books are recommended to read in order to know what they knew?
2. What are the math subjects that they were familiar with?
• Laplace was said to have instructed his students: Lisez Euler, lisez Euler, c'est notre maître à tous, "Read Euler, Read Euler, he is our master in everything." – DanielV Sep 1 '15 at 11:06
• There is a story about Euler when he was a young schoolboy. His classmates were being unruly, and to punish them, his teacher said none can be dismissed until they got the correct answer to the problem of adding up all numbers from 1 to 100. In seconds, Euler correctly said "5050". He did this not by actually adding up all the numbers conventionally, but by recognizing that the sum was 100+0 + 99+1 + 98+2 ... + 51+49 + 50. There were 50 pairs of numbers that summed to 100 and 50 left over, making 5050. – Michael Tiemann Sep 1 '15 at 11:17
• @MichaelTiemann, Hello, that was Gauss... – Megadeth Sep 1 '15 at 11:18
• @GudsonChou, Hello, that was actually nobody... – Asaf Karagila Sep 1 '15 at 19:37
• Dor, the simplest answer would be to read physics books and engineering books. Find a way to build a time machine, then build it, then go back and ask them in person. Who knows, maybe Gauss got a lot of his inspiration from that one person who went back in time to see what Gauss knew when he was 20-something, and that time traveler told Gauss about all this great discoveries, thus avoiding a paradox. – Asaf Karagila Sep 1 '15 at 19:41