-
-
In the last video we saw that
if you wanted to take a plus b
-
to the nth power, and if n is
larger than, really, 2-- but
-
really, especially larger than
3-- it is very tedious to
-
multiply it out, essentially
using the distributive
-
property, or doing polynomial
multiplication, or FOIL, or
-
however you learned it.
-
It is extremely,
extremely tedious.
-
And then we learned that the
binomial theorem, which said
-
this, that that is equal to
the sum from k is equal to 0,
-
to n of n choose k-- right?
-
Where that was what we learned
in combinatorics as the
-
binomial coefficient.
-
And that's why it's called a
binomial coefficient, because
-
it's actually the coefficient
of the binomial theorem.-- Of
-
x to the n minus k-- oh,
sorry, I keep writing x.
-
Let me undo that.
-
Edit, undo.
-
Edit, undo.
-
Oh, it's taking too long.
-
Oh, let me just-- oh no, that's
not what I wanted to do.
-
Let me erase it.
-
OK.
-
I keep writing x.
-
It could be an x, but then
this would have to be
-
an x here, as well.
-
-
Maybe I should do that.
-
--Of a to the n minus
k, times b to the k.
-
So each term-- you know, the n
stays constant-- but each term,
-
you start at k equals 0 and
you keep incrementing up.
-
And we did an example to solve
a plus b to the fourth power
-
in the previous video.
-
And as you saw, that was
tedious, but less tedious than
-
actually multiplying it out.
-
And if you get really fast
at computing n choose k
-
for different ns and k, it
could be reasonably fast.
-
So what I want to do is, I'm
going to show you a slightly
-
faster method than
what we just did.
-
Kind of a faster way to compute
the binomial coefficients.
-
And then after that, I'm going
to show you a super fast way
-
that, short of memorizing the
coefficients-- which I actually
-
know some people who've done
that-- is a pretty amazing way
-
to essentially multiply
out any binomial.
-
So what's my pseudo
fast way of doing it?
-
Well, I hinted in the last
presentation that those
-
coefficients were actually
terms of a Pascal triangle.
-
So what's a Pascal triangle?
-
So if we start off with a 1 and
then you just go-- actually,
-
let me do it-- well, yeah,
let me do it right here.
-
And then, actually let
me start with two 1s.
-
And what you do is, you take
the sum of both of these.
-
So that's a 2.
-
And then you bring down
a 1, to the left and
-
the right hand side.
-
And notice, these are
the coefficients of
-
a plus b squared.
-
-
And these are the
coefficients of a plus b.
-
You could say a
plus b to the one.
-
1a plus 1b.
-
This is a squared-- so you
could rewrite, a plus b
-
squared. is 1a squared
plus 2ab plus 1b squared.
-
So these are the coefficients
of a plus b squared.
-
Let me arbitrarily
switch colors.
-
And so, 1 plus 2 is 3.
-
2 plus 1 is 3.
-
Bring down the 1.
-
Bring down the 1.
-
And now we have the
coefficients for a
-
plus b to the third.
-
Which we computed in
the-- that was the very
-
first thing we did.
-
We actually multiplied it out.
-
And we just know the pattern.
-
The first coefficient is 1.
-
So it's 1a to the third, b to
the zero-- so we don't have
-
to write the b-- plus 3.
-
We just decrement
this exponent 1.
-
3a squared b plus 3ab squared,
and then plus 1a to the zero--
-
which is just 1-- b cubed.
-
So that was pretty fast.
-
And we can keep going down
the Pascal triangle.
-
So let's do the next one.
-
So we can bring down a 1.
-
1 plus 3 is 4.
-
3 plus 3 is 6.
-
And this is neat.
-
I mean, just very simply, you
can actually generate binomial
-
coefficients without
having to compute them.
-
Very simple, I guess you
could call it an algorithm.
-
Or drawing.
-
And it's symmetric, just as
you would expect it, right?
-
Because you could
easily switch b and a.
-
a plus b is the same thing
as b plus a, so you
-
should essentially
get the same answer.
-
And so, we just-- very quickly
we figured out the binomial
-
coefficients for a
plus b to the fourth.
-
Which was a lot faster than
we did in the last example.
-
a plus b to the fourth.
-
So then we-- I think
you get the point.
-
But, so it's 1-- let me write
in a different color-- 1a
-
to the fourth, b to the
zero, plus 4a cubed b
-
squared-- b to the one.
-
Plus 6a squared b squared.
-
Which makes sense that, you
know, this is a middle number
-
and they both-- and a and b
have the same exponent
-
at this point.
-
And then plus 4a-- we
decrement it-- b cubed.
-
Plus b to the fourth.
-
1b to the fourth, right? a
to the zero, so that's what
-
we didn't write there.
-
So 1b to the fourth.
-
And that was very fast compared
to what we had to do at
-
the end of the last video.
-
We could just keep going.
-
You know, for 5.
-
So 1 plus 4 is five.
-
4 plus 6 is 10.
-
6 plus 4 is 10.
-
4 plus 1 is 5.
-
Bring down the 1.
-
So these are the coefficients
for the expansion of a
-
plus b to the fifth power.
-
And so this is a reasonably
fast way of doing it, although
-
it can get-- one, it will
take a lot of space.
-
And it can work reasonably
well, you know, for up to a
-
power of eight or nine or ten.
-
Even then it starts to get
pretty big and cumbersome.
-
But you know, for powers
up to seven or eight or
-
nine, you could do this.
-
You could draw it out really
fast and do this, and it's
-
probably faster than actually
computing each of the
-
binomial coefficients.
-
Although you might be pretty
fast at computing n choose k,
-
in which you don't
have to do this.
-
So with that out of the way,
let me show you an even faster
-
way of doing it, short
of memorizing it.
-
And this will allow you to
really calculate a plus b
-
to the nth-- you know, to
the twentieth power--
-
almost in your head.
-
Depending on how good you are
at arithmetic in your head.
-
So here is the trick.
-
And I encourage you to
experiment for why it
-
works, but it does work.
-
And I mean it's
not even a trick.
-
It's just-- and this Pascal's
triangle isn't even a trick.
-
Pascal's triangle is just an
alternative way to generate
-
binomial coefficients, and what
I'm about to show you is just
-
another way of essentially
generating the binomial
-
coefficients.
-
Although it's probably a
faster way to compute them.
-
-
And it's a good project for you
to think about why this works.
-
So I'm just going to start
with a very concrete example.
-
Instead of a plus b, let
me just do x plus y.
-
Just because you might
see the binomial theorem
-
written that way.
-
So let's say x plus y
to the tenth power.
-
This would take me all
day if I was to actually
-
multiply it out.
-
It would take me probably 20
to 30 minutes, without
-
making careless mistakes, to
actually figure out all the
-
binomial coefficients.
-
Maybe not that long, but
it would take me a while.
-
And to draw Pascal's triangle
would fill up a whole page,
-
and I'd still probably
make a careless mistake.
-
So how can I do this?
-
So what you do is-- so
one thing you know.
-
This is going to have
11 terms, right?
-
Because you're going to
start with x to the
-
tenth, y to the zero.
-
And you're going to go all
the way to y to the tenth.
-
So if you start at 0 and you
go to 10, that's 11 terms.
-
So it has 11 terms.
-
What I want you to do
is just write down the
-
first, just the numbers.
-
You know, you can almost
count the terms.
-
You don't have to go all the
way to 11, and I'll show you.
-
But actually, let's write
all the way to 11.
-
So 1, 2, 3, 4, 5, 6,
7, 8, 9, 10, 11.
-
Just squeezed it in.
-
And you'll see, you don't
actually have to go
-
all the way to 11.
-
You could probably
just stop at 6.
-
So here's the trick.
-
We know that the first
term is going to be x
-
to the tenth, right?
-
We know that x to the tenth.
-
Actually, we know that it's
going to be x to the tenth.
-
The second term is going
to be x to the ninth.
-
Then it's going to
be x to the eighth.
-
It's going to be x
to the seventh.
-
A little tedious.
x to the sixth.
-
x to the fifth.
-
x to the fourth.
-
x to the third.
-
x squared.
-
x.
-
And then there's going to be
x to the zero, or just one.
-
Let me just do the y's.
-
So this was x to the tenth.
-
That's not bright
enough, this color.
-
So this is y to the zero.
-
So we don't have to
write it there.
-
But then we have a y.
-
y to the first.
-
y squared.
-
y to the third.
-
y to the fourth.
-
y to the fifth.
-
Which makes sense, this
is the middle term.
-
y to the sixth.
-
y to the seventh.
-
y to the eighth.
-
y to the ninth.
-
I don't want you to get
confused, each of these
-
is a separate term.
-
I don't want you to think
I'm multiplying them all.
-
-
And then, we just have to
figure out the coefficients
-
on each of these terms.
-
Those are divider lines
I attempted to draw.
-
I wasn't trying to
confuse you more.
-
I just wanted to-- because they
seemed to be running together,
-
each of the terms
that I'm writing.
-
But I think you know
what I'm doing.
-
So now we have to figure
out the coefficients.
-
And then this is the neat part.
-
So we know that the coefficient
on the first term-- let me draw
-
a dividing line here and here--
the coefficient on the first
-
term is always 1, right?
-
So, the coefficient is 1.
-
So the coefficient on the
second term is going to be the
-
exponent on the first term
times its coefficient-- so 10
-
times 1-- divided by
the term that it is.
-
So it's going to be 10
times 1, divided by 1.
-
So it's going to be 10.
-
The third term's coefficient
is going to be the
-
exponent on the x, right?
-
So it's 9 times its
coefficient-- which is 10-- so
-
it's going to be 9 times 10--
divided by the term it is.
-
So it's going to be 9 times its
coefficient, 10, divided by 2.
-
So what's 9 times 10?
-
That's forty-- it's 90
divided by 2 which is 45.
-
And you keep going.
-
The fourth term is going to be
the third term's exponent-- so
-
it's going to be 8 times-- let
me write this down in a
-
different color-- it's going to
be 8 times its coefficient,
-
times 45 divided by
which term it is.
-
So it's the third term.
-
Divided by 3.
-
Well, that's just 8 times 15.
-
And we'll see,
that's 80 plus 40.
-
So that's equal to 120.
-
So that is the fourth term.
-
And so then let me just
draw these dividers.
-
I know it's getting a
little complicated.
-
And I'm writing it all out like
this, but if you practice
-
this enough, you can actually
just write it straight out.
-
And so the fifth term.
-
What is the fifth term?
-
Well, you take the
exponent on the x.
-
So 7 times the fourth
term's coefficient--
-
times 120-- divided by 4.
-
Right?
-
Divided by the
previous term, by 4.
-
Well, that's just 7 times
30, which equals 210.
-
That's the fifth coefficient.
-
What's the sixth coefficient?
-
Well, it's 6 times-- you
know the exponent on
-
the x-- times 210.
-
Times its coefficient-- times
the fifth term's coefficient--
-
divided by 5, for
the fifth term.
-
Well, 5 goes into
210 how many times?
-
42 times, right?
-
So it's 6 times 42--
that's 240 plus 12.
-
That's 252.
-
And then once you're at the
middle point-- the sixth term
-
is the middle term-- you'll
see that, you know, you start
-
going back the other way.
-
And we learned one from the
Pascal's triangle, or even the
-
definition of the binomial
theorem, that the
-
coefficients are symmetric.
-
So we know that the next one is
going to be the same-- this was
-
the middle one, right?-- so we
know the next one is
-
going to be 210.
-
And you could calculate it
using the same system.
-
This is just a quick
way of doing it.
-
This one's going to be 120.
-
This one's going to be 45.
-
And this one is going to be
the tenth coefficient--
-
this is going to be 10.
-
And then of course the last
coefficient is just 1.
-
1y to the tenth power.
-
So if I were to write this out,
the answer is-- and if you
-
practice this, you'll find that
you can do quite fast-- it's x
-
to the tenth, plus 10x to the
ninth y, plus 45x to the eighth
-
y squared, plus 120x to the
seventh y to the third, plus
-
210x to the sixth y to the
fourth, plus 252-- already at
-
the middle term-- x to the
fifth y to the fifth, plus 210x
-
to the fourth y to the sixth--
I'm running out of space.
-
But you can you can hopefully
extrapolate what I'm doing,
-
and it makes sense to you.
-
And hopefully you have an
appreciation that if you
-
actually had to multiply out x
plus y to the tenth, it would
-
have taken you all day.
-
Maybe I'll do one more video
with a smaller example to show
-
you that it's a little less
complicated when you do, say,
-
x plus y to the sixth power.
-
See you soon.
-