*Image by petmutt on Flickr*

This past summer, I worked as a research intern at UCLA’s Institute for Pure and Applied Mathematics. My team’s project was sponsored by Google.

My three teammates and I were all math majors. The funny thing was, we didn’t do much that *looked* like mathematics. Sure, we had pens, paper, and chalkboards. But those were mostly used for plans and sketches. None of us touched a calculator. We spent most of our time at our computers– programming.

You might ask: Where is the math? Why is a mathematics institute hosting a computer science project?

There is a popular conception of “computer people” as tinkerers– people messing with wires and green chips and silver parts. Or, alternatively, as Hollywood-style hackers, pounding on a keyboard in a dark room, surrounded by beeps and blinking lights. Math doesn’t usually come to mind when we think about computer science.

In reality, the two fields have an incredibly close relationship. Although it may seem surprising, there is no sharp line where computer science ends and math begins. I recall one of my computer science professors describing the field as “a branch of applied mathematics.” (That statement is a bit controversial, but the fact that it can even be said tells you a lot.)

Much like you wouldn’t expect a pianist to bang randomly on a keyboard and hope for music, a person writing a computer program won’t throw out a bunch of lines of code and expect them to work. Planning, foresight, cleverness, and theory allow a person to write good code– that is, fast, efficient, readable, and aesthetically pleasing code. There’s a reason programmer candidates are given logic puzzles at interviews. Good code is important. And the process that leads to good code is not so different from what a person would recognize as mathematical thinking.

I’m talking here about programming, but computer science is much larger than that. High-level, theoretical computer science often looks a lot like theoretical math. There’s a crisp, definite, logical way of thinking that’s necessary in both fields. You can’t do computer science without it, and you can’t do math without it. The ways we think about the two fields are deeply related.

Here’s my guess as to why people often have no idea about the connection between math and computer science. First of all, the math in computers is generally far from the “front end” of the user experience. Math doesn’t have much to do with watching a YouTube video or writing an essay in Word. It doesn’t even have much to do with website design or fixing laptops. The deeper and more mathematical applications of computer science are often invisible– hidden in the internal mechanisms of websites, apps, and software.

I would also venture a second reason, which has to do with how people are exposed to math in general. Students in grades K-12 never hear about a lot of interesting, accessible areas of math.

I don’t know why math is taught the way it is in schools– why certain topics are presented in a fixed and standardized order. My parents learned the same things I did in high school: algebra, geometry, trigonometry, and some form of calculus. But they had never heard of the mathematical ideas that have played huge parts in the programming I’ve done– like matrices, recursion, formal logic, and congruences– and I didn’t really explore them until I was in college. There’s such a pervasive standard that one might think the traditional order is a necessary conceptual progression, that these are the most important topics of mathematics, or that these topics are all there is.

(As an aside, when it comes to college, it seems there’s a near tyranny of making people learn calculus first. I know many people who love branches of math completely independent from calculus, but cringe looking back on their introductory calculus courses. In many schools, calculus is a prerequisite not just for math, but also for introductory computer science courses. This is not because anyone I know has ever used advanced calculus while programming, but because for some reason or another, we use calculus to filter students by mathematical proficiency.)

There’s no mathematical reason why we have to teach math this way. Topics like linear algebra and graph theory are perfectly understandable without calculus or geometry. In fact, all the varied topics I mentioned above can easily be learned after basic algebra, and some even without knowing algebra at all. So a person who only learns math in high school misses the opportunity to find out about the kinds of math that relate to computer science. They may remember that there is such a thing as a cosine or an isosceles triangle, but they won’t recognize the mechanisms behind search engines and spam filters as math.

This is a pity. A lot of that kind of math is actually simpler, more fun, and more puzzle-y than what gets taught in schools. And what’s more, computer science is changing the world dramatically, and many people don’t realize how deeply it is related to math.

In the next post, I’ll talk about how math and computer science are different: not so much in terms of content, but in terms of “feel.”