Main content

### Course: Math for fun and glory > Unit 1

Lesson 2: Doodling in math- Doodling in math: Infinity elephants
- Doodling in math: Stars
- Doodling in math: Binary trees
- Doodling in math: Sick number games
- Doodling in math: Squiggle inception
- Doodling in math: Connecting dots
- Doodling in math: Triangle party
- Doodling in math: Snakes and graphs
- Doodling in math: Dragons
- Doodling in math: Dragon dungeons
- Doodling in math: Dragon scales

© 2024 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# Doodling in math: Binary trees

Thank you to all the people I know whose math classes do not require such pastimes!More videos/info: http://vihart.com/doodlingDoodling Snakes + Graphs: ttp://www.youtube.com/watch?v=heKK95DAKmsDoodling Stars: http://www.youtube.com/watch?v=CfJzrmS9UfYhttp://vihart.com. Created by Vi Hart.

## Want to join the conversation?

- How can I explain this to my math teacher that this is math and have proof?(3 votes)
- how long can you go with 1000 pieces of paper? 10,000? 100,000? 1,000,000?(2 votes)
- and it also depends on how wide you make the tree and how you place the paper(1 vote)

- Who is still using Khan Academy rn? Me!🙋🏻♀️(2 votes)
- Does this technique also work for prime factoring trees? "0:54"(2 votes)
- I don't think so...(1 vote)

- I always thought binary trees were for making combinations?(1 vote)
- so does vi do all the videos in a day?(1 vote)
- Actually, she says on her website that it takes about a week per minute of video.(1 vote)

- how did vi join khan academy?(1 vote)
- I am a kid still in elementary school and it has been hard for me to understand binary trees and such. This has helped me a lot. What are binary trees??(1 vote)
- Trees are data structures used in programming, or undirected (in which the directions don't matter) graphs in graph theory (which I don't know much about). A tree has a base (the node at the top), and can have descendants, which are nodes below it. Each one of the nodes contain a value (or null, which stands for empty). For a structure to be a tree there must be only one path of connections from each node to any other node.

A binary (of the base of two) tree is a tree in which each node can only have up to two descendants. A unary (of the base of one) tree can have only one descendant, ternary (of the base of three) trees have up to three descendants, decimal trees up to ten descendants and so on.(1 vote)

- what's the power of two?(1 vote)
- what does this has to do with binary? no ones or zeros.(1 vote)

## Video transcript

OK, let's say you're me,
and you're in math class. You're supposed to be learning
about exponential functions, but you're having trouble caring
about exponential functions because, unfortunately, your
math class is probably not terribly engaging. You're supposed to be drawing
and labeling some axes so that you can graph this
y equals 2 to the x thing. And your teacher seems to think
that drawing and labeling axes is the very essence
of mathematics. But you're bored and can't
help but wonder, why? So you do what any
conscientious student would do in this situation
and start doodling. And because you're me, you like
to play games with yourself when you doodle. Here's one game. You're drawing a line. But when it crosses
one of the blue lines one your little piece of paper,
it splits into two lines. Maybe this line is like the
neck of a mythical hydra, where every time one of its heads
gets chopped off by a blue line, it grows two more in its place. You want to see if you
can get all the way to the bottom of the
page following this rule because, if you do, then you
can draw all of the little hydra heads at the end. But you don't get very
far on your first try. You decide to try again,
this time spacing things out a little more at the beginning. Unfortunately,
things are filling up fast, though you got
farther than last time. Maybe if you have
more room, or maybe if you sharpen your
pencil more, you can get to the
bottom of the page. Oh, and don't forget to
draw and label your axes. If each broad swing of
Hercules's sword chops off all the heads, that's
doubling your number. Well, you can see
where I'm going. I'm not going to try
and teach you math, just how to wield it
for doodling purposes. In this case, that's going
to be a lot of heads. Good luck Hercules. But maybe drawing binary
trees all straight like that is not an interesting
enough game to hold your attention for long. So you start drawing
them in arbitrary shapes. Or less arbitrary shapes. Maybe you start drawing a binary
tree that looks like a tree. And maybe you can't see this
tree in very high quality because your camera, much
like your math class, is fuzzy, unfocused, and
altogether not very good. Maybe you change
the rules slightly and make a ternary bush, where
each branch sprouts three more branches. Unfortunately, your math
class is 45 minutes long, and soon you need a more
interesting doodle game. So you go back to the game
where your line splits at every level, only
this time, instead of trying to squish
all the lines in, you let them hit each other. And when they crash,
there's a fiery explosion, and the crashing lines end. There. Maybe you turn your
notebook sideways so that you can make sure you're
getting the horizontal spacing right. Maybe, to go back to
mythology, Hercules has a method where,
instead of cauterizing the necks of the Hydra to
keep them from growing back, he's found that the necks stick
together if they get too close. And instead of
growing new heads, they just fill up with blood. It might seem a little
morbid for math class, but maybe if the curriculum
wasn't so appalling, and the teaching methods
weren't so atrocious, you wouldn't have to
entertain yourself with these stories and games. Speaking of this doodle game,
something very interesting is happening. Looks like your simple rules
about splitting and crashing are creating
Sierpinski's triangle, which is a pretty
awesome fractal. But the point is not to
learn about fractals, or cellular automata,
or Sierpinski, but to show that
simple doodle games can lead to mathematical results
so cool and beautiful that they're famous. At least, famous
to people like me. And if you're good at
inventing doodle games, you might even end up
doing some real mathematics during your math class. Anyway, maybe you don't
care about accuracy. Maybe you try the
game again, only you don't keep track of spacing,
and when you make a mistake and accidentally grow heads
where you shouldn't, you just roll with it. Now you've introduced an
element of random error, and you want to know how this
will affect the final picture. It still looks like a
pretty awesome doodle and has many of
the same elements, though it lacks the structure. Speaking of the structure, maybe
because you're really, super bored, and your class is
seemingly never going to end, you start looking at the
number of necks at each level and trying to figure
out the pattern. Maybe you haven't forgotten
about powers of two. Anyway, I hope I've
provided you with something entertaining to do
next time you're bored. Good luck with your math class.