What is a good route for a math student to self study computer science systematically and efficiently?

If you are at a university offering computer science degrees, you could find out the names of a few courses that are required for 2nd or 3d year students, get a copy of the text book for one of them, and try to read it.

One thing making your task harder is that computer science is a very wide field, and no one book covers everything important. In part because "computer science" is an amalgam of computer engineering, of computer practice, of applied mathematics, and so on: unlike (say) linear algebra, there is no small set of basic axioms that can be neatly explained and exploited in a few hundred pages. Rather, imagine you wanted to systematically and efficiently learn automobile science. You might find a book that explains car engines and the related chemistry of combustion and pollution control, but says nothing about motion planning or an automobile's HVAC system, etc.

Added, after a few minutes. The comments following Henning Makholm's completely reasonable answer seem to me to illustrate the point I made above: computer science is so complex a subject that it is hard to agree what is most essential.

Let me add a particular recommendation: I have noticed that some of my colleagues do not know about the connection between DFAs and regular languages. This seems to me to be as fundamental a result in theoretical CS as (say) the Pythagorean theorem is in geometry, or as integration by parts in calculus. And more important than many computer hardware implementation details. If you don't know that, you don't know squat. So your goal might be, read enough of Aho, Hopcroft, and Ullman (or equivalent textbook) to understand this important result.


Based on the belief that computer system and programming can be completely theoretical, I decided to learn from the very basic.

It's a bit arrogant to stick too tightly to such a belief when you're still learning the field don'tcha think?

Some areas of computer science can be called "completely theoretical". Computability theory and complexity theory come close, as do some of the more wild-eyed branches of programming language research. They merge into parts of logic and category theory that could be called "computer science by conquest" because computer scientists are interested in them -- though at the best conferences you will also find people with Dept. of Mathematics affiliations, and some even use blackboards for their talks!

However, in most of computer science as a field, the lifeblood of the science is the tension between nice theoretical models on one hand, and the need to build systems that work on actual physical devices that can be produced economically on the other hand. To insist on studying only the theoretical side amounts to throwing out not just half of the field, but the entire crunchy middle too.

In your position you probably ought to start by a computer architecture textbook, and then learn (really learn) a low-level programming language such as C. Though this will offer you copious opportunity to shoot yourself in the foot, it might also be the only way to satisfy your (in itself laudable) desire to understand the entire stack of abstractions all the way down. And the mistakes you'll make with C might help you understand the point of the more abstract concepts of more modern languages.


I wish there are some theoretical textbooks that build the whole operation system, compiler, or some of this kind, that is readable to math students.

I highly recommend reading The Elements of Computing Systems by Nisan and Schocken, and doing all the projects. You make a computer from scratch, starting with NAND gates. Along the way you make a compiler and a simple operating system. In the end you make a simple video game such as Tetris that can run on the computer you've designed. The book's companion website is www.nand2tetris.org.

It is my favorite textbook on any subject.

You might also be interested in Knuth's The Art of Computer Programming, though I haven't read it myself.