Note from Ray: At our recent RWDevCon tutorial conference, in addition to hands-on tutorials, we also had a number of “inspiration talks” – non-technical talks with the goal of giving you a new idea, some battle-won advice, and leaving you excited and energized.
We recorded these talks so that you can enjoy them, even if you didn’t get to attend the conference. Here’s our second talk – Math Isn’t Scary, by Matthijs Hollemans – I hope you enjoy!
Transcript
I would like to start with a show of hands. Who here understands this?
func countOccurrences(value: Int, array: [Int]) -> Int { var count = 0 for element in array { if element == value { ++count } } return count } let array = [100, 28, 999, 43, 62, 999, 77, 35, 999] let value = 999 let count = countOccurrences(value, array) println("\(value) appears \(count) times") |
I was hoping for more hands :]
OK, this is a piece of source code, right? There’s a for loop, an if statement; it’s a pretty basic algorithm for counting how often something appears in an array. This should be a piece of cake for most of you.
Now, raise your hands if you understand this… don’t be shy!
Image may be NSFW.
Clik here to view.
As you probably guessed, this is a piece of math.
In case you did not recognize this, this is the explicit formula for the prime counting function. I have to admit that I don’t completely understand it myself, I just Googled for “difficult math equation” and this is what came up.
I saw some people raise their hands, so if you’re really curious, if you really want to know what this means, I’m sure they’ll be happy to explain it to you afterwards.
I get the sense that what I’m showing in this slide is a lot more intimidating to you guys than the source code. I’m sure some people here went like, “Ugh, math.”
Math has a pretty bad reputation, not just among normal people but also among us software developers.
Let’s Turn That Frown Upside Down
Image may be NSFW.
Clik here to view.
The point I want to make in this talk is:
- Math is actually pretty cool
- It can even be a lot of fun
- It’s not really that different from software development
- And most importantly, I want to convince everyone here that they are already a lot better at math than they may think.
Let’s get started!
Why Math is Reviled
Clik here to view.

How Vladimir Putin Feels about Math
Let’s start with why math is so reviled.
- If you don’t like math at all…
- If the thought of doing math gives you hives…
- If you have nightmares of doing multiplication tables or trigonometry…
…then you, poor listener, may suffer from what’s known as mathophobia, or math anxiety!
Where did you pick up this nasty-sounding affliction? Well, believe it or not, it’s been claimed that math anxiety is a disease caused by school.
Think about that for a second. The reason why math gives you the heebie-jeebies is the way it is taught in the traditional classroom. If you’re terrified of doing math, then you have this. It’s a very real thing, and it affects almost every one of us.
Except, of course, for that lucky handful of people who actually enjoy doing math. Even for them, it’s been suggested that they only managed to succeed in learning mathematics was despite what they were taught in school.
Math and Piano Lessons
I have this book, it’s called How to Play the Piano Despite Years of Lessons:
Image may be NSFW.
Clik here to view.
I only started to play the piano in my late twenties, because for years I had this limiting belief that if you wanted to become good at the piano, it was impossible unless you started to play the piano when you were five years old.
It turns out that a lot of the kids who take piano lessons actually end up hating the piano just about as much as they hate math, and for pretty much the same reasons, too.
Now, for those of you who did not take piano lessons, the way the piano is usually taught is pretty similar to the way math is taught. You have to memorize a lot of facts, and you have to do practice drills over and over and over and over. There’s not much room for creativity, or for having fun.
I mean, it’s got playing the piano, right? You have to be able to play, you have to be able to enjoy it, you have to be able to mess around with the piano.
Well, try telling that to your drill instructor!
Mechanical Process vs True Understanding
There’s no deeper understanding of music with those traditional piano lessons. It’s just this mechanical process for playing the right notes, and the playing the right time.
The same thing is true for high school mathematics. You don’t really learn the deeper understanding of what mathematics is all about in school; all you learn is this mechanical process for doing calculations. I’ve got a computer who can do calculations much better than I can.
There’s no reason why an adult, or even a child, would have to do long division by hand. That’s something that computers are good at. School doesn’t tell you why you want to do long division in the first place.
Now, the full story goes something like this, and I quote:
How sad is that? Taking music lessons, taking piano lessons, actually ruins music for a lot of kids. How familiar does that sound to math?
I really wish that this book existed: How to Play Math Despite Years of Lessons.
Image may be NSFW.
Clik here to view.
Play is also the right verb here, because doing math should really be like playing a game or solving a puzzle.
If you feel like you were no good at math, it’s not really your fault. You’re not defective. You just weren’t taught properly. Math anxiety is the result of bad teaching. That’s all there is to it.
Are we all irreparably damaged by our failed educations? Well, no, I don’t think so. You’ve suffered some minor setbacks, but that’s no reason to give up on math. Math is too beautiful for that.
Math Can Be Fun!
Now, I know these last couple minutes have been a bit of a downer, so in order to cheer you up I have a photo of people having a good time.
Clik here to view.

Attribution: lo-ny
I think they just solved some math problems, so now they’re out celebrating.
I said that math can be fun, something that you can really enjoy doing, like these people. I suspect that some of you might be a bit skeptical about this, so I’m going to back up my claim with the following piece of evidence.
I probably don’t have to explain to you what this is. It’s a Sudoku, right?
These things are super popular, they’re played by millions of people around the world. Does anybody here like doing Sudokus? That’s what I thought.
Now, you’re going to say, “That’s not math, it’s a puzzle,” which is true. It’s a puzzle with numbers.
Well, a lot of mathematics is puzzles with numbers. Solving puzzles is what human beings love to do. We just can’t resist it. It’s how our brains are wired. That’s why kids love games, because a lot of games are about puzzle solving.
Whether you like it or not, this is math; you just don’t think about it that way. I hope I just didn’t ruin Sudokus for you, but a lot of the math that we learn in school, or are supposed to learn in school, isn’t really much harder than this. In both cases, your brain does exactly the same things.
My girlfriend, Deanna, her brain freezes up just at the thought of having to do math; but for some reason, she really likes this game:
Image may be NSFW.
Clik here to view.
For those of you who don’t know this, this is Rummikub. You have numbers, you arrange those numbers in certain patterns, and then you rearrange them. The first one to get rid of their numbers wins.
This game really exercises your math muscles. You have to do pattern-based thinking, pattern matching, you have to think steps ahead. She doesn’t think about it as math. It doesn’t trigger the bad memories she has of school, and how she used to get upset at her math homework. She also beats me way too often at this game.
Another game she likes is blackjack:
Clik here to view.

Attribution: Images Money
Now, to win at blackjack, you have to know all about odds and probabilities; or you have to learn card counting, but the same thing goes here. It’s all mathematics. That’s true for bridge or poker or any other game, or lots of games.
Many of the games you play are fundamentally mathematical in nature, but we don’t mind it because it’s not like doing the math that we used to do in school. It’s not really math that we dislike, it’s just our school experiences that we don’t like. The math itself can be pretty awesome.
I’m sorry to break it to you, but if you’re the kind of person who likes puzzles and games, then you’re probably a closet mathematician.
Learning Math is Like Learning a Programming Language
Let’s say five years ago, or two years ago, or however long ago you first started programming, and they showed you this, it probably wouldn’t have made much sense to you.
func countOccurrences(value: Int, array: [Int]) -> Int { var count = 0 for element in array { if element == value { ++count } } return count } let array = [100, 28, 999, 43, 62, 999, 77, 35, 999] let value = 999 let count = countOccurrences(value, array) println("\(value) appears \(count) times") |
You first had to learn the language – not Swift, but the language of computers and programming.
How does a compiler work? What’s a variable, what’s a function, and a thousand other things.
It was probably pretty hard to learn, in the beginning, anyway, but eventually you figured it out, and now you speak Objective-C or Swift, or whatever language. You speak it fluently.
If we show this to someone who just starts programming, or who hasn’t done any programming at all, it probably looks like a bunch of gobbledygook. Just like this looks like a bunch of gobbledygook to someone who doesn’t speak the language of math.
Image may be NSFW.
Clik here to view.
The point I’m trying to make here is that you’re all smart people. You’re very intelligent people. You’re software developers. You do difficult stuff all day long.
Math isn’t any harder than what you already do in your daily development jobs. If you were able to learn programming, I’d say you’re pretty much able to learn anything, even math.
What you do on a daily basis is the same thing that a professional mathematician does on a daily basis:
- You build these elaborate thought structures in your head
- You think through problems
- You solve puzzles
- You think creatively
You already act like a mathematician; you just don’t speak the language yet.
Why Bother?
Okay, fine. Let’s say I’m right, developers are like mathematicians. So what? Why should we bother learning about calculus or statistics or algebra? What do we need that kind of math for, anyway?
Well, I’d say if you want to create any piece of software that’s remotely interesting, you could use some mathematics.
For example, games. If you want to make games, even simple 2D games, it’s really helpful to know something about trigonometry.
Clik here to view.

Trigonometry is important for games!
All of the hot areas in software development of today — machine learning, big data, computer vision — all require solid math skills.
I have an interest in audio programming and digital signal processing, and that requires knowledge of things like complex numbers, fourier analysis, and when I didn’t know the math, it was very hard to do all this stuff. As I started studying the math behind it all, it made a lot more sense to me.
If you want to get ahead in your field, if you want to stay relevant, even, it’s really helpful to know a bit more about mathematics. Besides, knowing math will make you a better programmer, and better programmers make more money.
Clik here to view.

A developer who knows math
Just in case you need some extra motivation!
How To Learn?
Let’s say I’ve convinced you to give math a second chance; how would you go about it?
Well, the book I mentioned, How to do Math Despite Years of Lessons, it does exist, sort of. This book’s called Math Overboard.
Image may be NSFW.
Clik here to view.
I used it to brush up on my high school mathematics a little while ago. It’s not perfect, but it’s a lot more accessible than standard textbooks, and it’s written for adults, so this is a pretty good place to start.
There’s also Khan Academy. These guys have a ton of free videos on math and lots of other subjects. Essentially, all the math that you need to know as a software developer, you can learn here.
Also, lots of universities are putting out their courses online for free, but if you want an easy place to start, then Khan Academy is a good place.
Now, if you just want to get your feet wet and explore some mathematical ideas without too much commitment, then why not read popular science books, such as this one, called 50 Mathematical Ideas You Really Need to Know:
Image may be NSFW.
Clik here to view.
Or, listen to a podcast such as this one. It’s from the BBC; it’s called A Brief History of Mathematics:
Image may be NSFW.
Clik here to view.
There are a lot of entertaining stories about math, and the people who used to practice math throughout the ages. There’s lots of intrigue, there’s lots of drama, but these stories can also give you an appreciation for the art of mathematics, and how fascinating it can be.
You can’t really learn math just by reading about it. You also have to put it into practice. That means you have to do some hard thinking from time to time. These are math puzzle books, and these math puzzle books are a great way to get a feel for what it is to think through mathematical problems.
Image may be NSFW.
Clik here to view.
If you like to do puzzles, if you like to do Sudokus, then these can be a lot of fun. They sell them at any bookstore, they sell them at airports, so you might pick one up on your way home.
If you’re ready for a real challenge, then give Project Euler a try:
Image may be NSFW.
Clik here to view.
This is a website that has lots of mathematical challenges, but the interesting thing is that you often have to write a short program to solve those puzzles. This tests your math skills, it also tests your programming skills.
Start Small
Image may be NSFW.
Clik here to view.
My advice is that you start easy, that you get over this limiting belief that math is somehow this horrible thing. There are recent stories about mathematical discoveries, and learn to see the beauty of mathematical ideas.
By the way, I said mathematical ideas can be beautiful a few times now, so what do I mean by that?
Well, you’re coders. You probably know beautiful code when you see it, right It’s basically the same thing. A beautiful mathematical idea, or a beautiful piece of code, is a thought or idea that’s expressed in an elegant way. It’s like the opposite of a hack.
I’m pretty sure beauty in mathematics, that you’ll recognize it when you see it. If you want to get serious, brush up on your basics first, basically learn all the high school stuff, but in a nice way this time. Get something, the books like Math Overboard, or Khan Academy.
Then from then on, it really depends on what you want to do. Math is this huge field. You can’t possibly learn it all, so pick something from areas that interest you. For example:
- If you want to get into audio processing or video processing, learn about complex numbers and fourier analysis.
- If you want to do 3D games, learn about linear algebra.
You can pick, just a topic here, topic there. There’s lots to explore, lots to learn, and you’ll never run out of stuff to learn for the rest of your life.
Math Isn’t Scary, but Can Be Hard
Now, I won’t lie to you; on your schedules, it actually said the talk is called “Math Isn’t Hard,” which is my mistake. It should have said “Math Isn’t Scary,” because math can definitely be hard.
It can be hard, it can be frustrating, and it’s very much an uphill climb. I get stuck all the time, but it doesn’t matter, because learning anything new is always hard. Finding bugs is hard, fixing bugs is hard; but it’s also half the fun of programming, right? I mean, I think it’s half the fun of programming.
It’s okay to be confused when you’re learning math, it’s okay to be wrong. It’s okay to struggle. Even professional mathematicians are in a state of constant confusion. It’s no big deal; the only thing that really matters is that you’re thinking about this stuff, because the thinking is what literally makes you smarter.
Clik here to view.

Attribution: _Untitled-1
Math isn’t really that scary. It’s only as scary as learning to program is for a newbie. You’ve all been there.
You’ve all had to learn programming at some point, and you stuck with it, and now here you are. You’ve been able to learn programming; I’m pretty sure you’re all able to learn mathematics.
I hope I’ve inspired you a little to give math another go. Play around with it, explore some of those mathematical ideas, such as how does Pythagoras work, where does pi come from, why are prime numbers such a big deal. What’s the point of negative numbers, anyway? It’s these simple ideas, simple thoughts, but they get you thinking about math, and you take it from there.
I wish you all a safe and happy journey through the land of mathematical ideas!
RWDevCon Inspiration Talk – Math Isn’t Scary is a post from: Ray Wenderlich
The post RWDevCon Inspiration Talk – Math Isn’t Scary appeared first on Ray Wenderlich.