If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

# 3D path counting brain teaser

## Video transcript

let's see if we can extend the path counting brainteaser to three dimensions so let's say that I had a 3x3 cube I'll keep it at three by three to keep the math from getting too hairy so let me draw it like that I won't use a line tool just because well maybe I should've so let's see the front of the cube looks something like that that's the front of the cube and the cube goes backwards like that comes down it's like that it's a 3x3 like a Rubik's Cube and I could have drawn this a little bit better but I think this will meet our needs okay there you go 3x3 cube and so our goal is to get from this back left cube this top corner back left cube and get to this front bottom right cube so this is our goal I'll do it in this yellow this is our goal right there and we are allowed to either go forward from any cube these are our three operations or our three movements we can do we can go forward or I guess towards the front we could go down we could go down or we could go to the right so I can't draw here oh I could draw here we can go from that cube to that cube so just like the two-dimensional problem you are only allowed to make forward progress you're not allowed to come down here and then go to adapt over here you're allowed to go down here then here but then you're not allowed to go up so every step you're getting a little bit closer from this back left top cube to this front front bottom-right cube and so the same question applies how many different ways are there to get from there to there and you can pause it now and try it yourself because I'm about to explain how to do it and the first thing you know when you tried to do it yourself is to realize that why this is hard to visualize even if I had to draw this out it will have to go in and out I mean how do I even visualize a three-dimensional cube like this and and and the best way to do it is to separate visualize each of the separate layers so let's do that let's make this the magenta layer up here we'll call that layer one so this is the magenta layer up here and you'll see what I'm doing in a second this is the I don't know the move layer right there the move layer and then finally I'll do I'll do the orange layer the orange layer is that one right there we can do is separately draw each of these layers so first let's do the magenta layer so the magenta layer will look like this and now I'll use things that help nope not like that I want to use the other tool the magenta layer let me draw some squares in here it's like that and like that and like that like that and then let me the middle one was the MOE layer draw that the move layer looks something like that it's like you could imagine I'm slicing it and just looking at it from above that's the idea here and it's going to help us visualize this problem so the move layer looks something like that and then finally the orange layer orange layer looks like this we're almost ready to actually start doing the problem good enough so just to make sure we understand our visualization this layer up here we call that layer one that you put this is box one this layer is layer two okay so up a little to here and now I don't want to get these confused with the paths and all that so I'm writing it really small and this is layer three or level three and that's right there and just to make sure you understand this corner right there this is our start point and that's right there all right because this is the whole top so this is the back left of the top and our finish point the bottom right is right here so essentially our problem goes from how many ways to get from there to there to how many ways to get from there to there so let's just stay within a layer so how many ways can I get to this point right here well I can only go from this point and go straight in the layer like that so there's only one way to get there right that movement is the exact same movement is this right here going from this box to this box is one way to get there that's the same thing as there and similarly I could go there and I could just go one more step so there's only one way to get there and that's like going like there and then there and by the same logic I could go one to the right here that's the only way to get there or I can go to to the right there and that's the only way to get there and now if you watch the if you watch the the two-dimensional path counting brainteaser you know that there's two ways to get here and the logic is well you could draw it out you could go like that one two and that's the same thing as going and saying one two well it's easier to visualize here but the general logic was well to know how many ways to get to any square think about the squares that lead to it and how many ways can I get to those two squares and then sum them up right and by the same logic so there's two ways to get here that's that cell three ways to get here right 2 plus 1 is 3 1 plus 2 is 3 and then 3 plus 3 is 6 so there are 6 ways to get to this cube right there from that one so this isn't too different from the two-dimensional problem so far but now it gets interesting so how many ways I'll just do it I did this in yellow but I should have done it in the color of that layer how many ways are there to get to this cell right here this cell is is that one right there well I start here and I can just go straight down right there's there's only one way to be there but I go straight down so there's only one way to get there right and actually let's extend there's only one way to get here if I'm going straight down and so there's only one way to get to this cell to do I'd have to go straight down again so there's only one way to get there hopefully you understand the kind of the way we're visualizing it this is the bottom row and there's only one way you have to go you go from here straight down to there are straight down to there that's the only way to get there fair enough now ha this is where it gets interesting how many ways are there to get to this cell well in our old example there was only one way in two dimensions to go from this cell but now we can go from this cell and we could come from above and whereas above above is right there so now we add this cell to that cell so one plus one is there are two ways to get there how many ways to get to this you can't even see this is kind of in the back middle of this of this cube how many ways to get there well there's two ways to come from this direction and I can also come from above right there so two plus one is three how many ways to get here well one from behind and then one from above so that's two you see a little bit of symmetry and how many ways to come here well there's two here from going straight forward right two ways to go that way and then one way to come from above that's that one way I don't know that we're on this cell so there's if we are so we're actually this is two and we're on this cell so if we wanted to how many ways to get to this cell there's two ways to go from there and then one way from above that's three and now right here how many ways to get to this cell there's three ways I could come from here from here or from above or from above so I have the two plus two plus two is six likewise here six I can come from 6 plus 3 is 9 but I can also come from above from here so there's 12 ways to get there and you can do the same logic how many ways to get here well within the same row there are nine ways right 6 plus 3 is 9 and then you can come from above as well that's 12 and then finally how many ways to get to this cell right here which is this one right there well I could come from there's 12 ways to get here so I can go all of those ways 12 ways to come from behind it so it's 24 and then 6 ways to come from above right so 12 plus 12 is 24 plus 6 is 30 I think you're seeing the pattern so how many ways to get here what's 1 plus - which is three how many ways to get here well it's three plus three which is six how many ways to get here it's one way here and two from above so it's three how many ways to get here well three from behind and three from above that's six here it's three plus three is six but you could also come from above so six again so that is 12 how many ways to get here 12 plus 6 is 18 but I can there's 12 ways to come from above as well so 18 plus 12 is 30 and by the same logic there's 18 ways to get here from these two cells but I could also come from above so that is 30 so how many ways to get to this last cell where there's 30 from this direction 30 ways from there 30 ways from behind it that's 60 and then there's another 30 ways to come from above so there are 90 ways there are 90 ways I could write that there but you can't see it 90 ways to get from that cell over there to this cell over here and in the last video I made the analogy to the binomial theorem and I'll leave you to think about what the three dimensional analogy is and I'll draw out a word which you which is never really mentioned in math class because it's normally too hairy to deal with think about formulating a trinomial theorem to help you multiply things like X plus y plus Z to the nth power and think about how this cube or an extension of it this is a 3x3 by this is a 3x3 cube but imagine if it was a or 3 by 3 by 3 cube but imagine if it was you know an N by n by n cube then you can start you know taking things to arbitrary powers so I'll let you to leave you to think about this but I just thought this was a neat visualization problem which is really not any more difficult than the last one actually before I leave you I'll leave you with just a general principle and this is actually really useful for some standardized tests or just logic games is if I'm trying to get to that to this cell and let's say I have a bunch of other you know I ups I didn't want to do that let's say there's a bunch of ways to get here and it has to have direction so I won't go into a whole graph theory thing because but it has to have direction and you can't have cycles you can't go because then you could have an infinite ways to get to a certain point and let's say that there are X ways to get there Y ways to get there is e ways to get there and a ways to get there cycle through the alphabet and this is just a subset of the larger graph right this graph could have you know a bunch of just you know you know connections this is just where we are these are all of the nodes that connect to this the general rule that we've learned in the last two brain teasers is you just you say okay how can I get to this node well I can go from here here here here and I just have to add up so if I can get from here there's X ways to come via this node Y ways to come via that node Z ways to come via that node a ways to come via that node so the total ways to get to that node is X plus y plus Z plus a and you can actually you'll see problems like this if you ever plan on becoming a lawyer they actually do have problems like this on the LSAT that aren't maybe as as complicated what we did here but you need to understand this principle anyway hope you enjoyed that