Here is my first #TorqueGroup post! Please tell me anything you like/dislike about it, if anything is unclear, or anything else!
Recursion is using smaller cases to construct larger cases.
Here are some signs that recursion might be a good method to attack a problem:
The problem asks for the value of a large case, and you can determine small values or they are given.
There is a clear connection between small cases and large cases.
Here are some steps helpful when applying recursion to a problem:
Analyze small cases.
Try to construct larger cases using smaller cases.
Make a conjecture about a connection between a larger case and the case[s] smaller than it.
Prove your conjecture.
Determine the answer using the connection you found.
Let us begin with a simple example:
A collection of 8 cubes consists of one cube with edge-length for each integer , . A tower is to be built using all 8 cubes according to the rules:
Any cube may be the bottom cube in the tower.
The cube immediately on top of a cube with edge-length must have edge-length at most .
Let be the number of different towers than can be constructed. What is the remainder when is divided by 1000? (AIME)
Your initial instinct may be to try casework based on which position a certain block is in, or maybe you thought that complementary counting was a good approach. However, recursion turns out to be a very fruitful approach to solve this problem. Looking back at our signs:
The problem asks for the value of a large case, and you can determine small values or they are given.
Yes, the problem asks about a tower with 8 cubes, and finding the number of towers of 1, 2 and even 3 is very simple, as the restriction doesn't matter.
There is a clear connection between small cases and large cases.
Yes, to get from 4 cubes to 5 cubes, simply add a cube, although the method of doing that may be slightly trickier.
Let be the number of towers of cubes. Let us apply our steps above:
Analyze small cases.
With 1 cube, there is clearly only 1 possible tower, so . With 2 cubes, there are possible towers, and . With 3 cubes, there are possible towers, and .
Try to construct larger cases using smaller cases.
If we have 3 cubes, and want to place the 4th, where can we put it? We can clearly put it on the bottom by the first rule in the problem. Following that thought, we can put it on top of the 2 or the 3, but not the 1. Then, we have 3 places we can put the 4th cube, and so .
If we have 4 cubes, and want to place the 5th, where can we put it? We can put it on the bottom, or we can put it on top of the 3 or the 4. Therefore, there are 3 places we can put the 5th cube, and .
Make a conjecture about a connection between a larger case and the case[s] smaller than it.
We can conjecture that for . Luckily, this connection only depends on the previous term, so the work is easier.
Prove your conjecture.
If , then the cube can go on the bottom, or on top of the cube or the cube. Then, we conclude that , as for each tower with cubes, the cube can go in 3 places.
Determine the answer using the connection you found.
Finally, , and .
Well, that wasn't that bad, was it? I guarantee casework and other methods would have taken longer. Now that we have seen a more basic application of recursion, let us dive in deeper with another problem.
In how many ways can 7 teams place in a tournament if ties are allowed?
First, let us try to understand the problem, and I think a good way to go about that is by listing some possible orderings. Let the teams be numbered 1 through 7. We could have 1 be first, 2 be second, and so on till 7 which is last, or we could have 1 and 3 and 6 tie for first, and the other four teams tie for second, or we could... You know what, I'm starting to think that there might be a few too many possibilities to list. In fact, even without ties, there are possibilities.
Now, let us try casework. If there are no ties, there are possibilities. lf there is one tie between two teams for first, we first pick the two teams that tie, and then order the remaining five teams. In fact, the number of possible placements, assuming teams are indistinguishable, is equal to the number of ordered partitions of , which you will soon see in problem number 1 below. I'll tell you this much: it is way too large to do by hand.
As this post is about recursion, I hope you are now thinking about how to apply recursion to this problem. Sign number 1 (asks for a large case, small cases are determinable) is satisfied. Number 2 (connect larger cases with smaller cases) is also satisfied, as all we do is add a team. Now, let us try to think about how a recursion would work...
If we have 6 teams, and want to place the 7th, where can be put it? If there are no ties in the 6 teams, this question is not so difficult. We can have 7 tie with any of the other 6 teams, or we can have it not tie, and be first, second, third, ..., or last. But what if there are ties? Say there is one tie. Then, we can have 7 tie with any of the 5 (do you see why 5 now?) other places, or it can not tie, being first, second, third, ..., or last. Continuing this train of thought, if we knew how many possibilities there were for 6 teams in 4 "groups," then we could place the 7th team tying with one of the 4 groups, or it could be alone in 5 places. This starts to sound like a recursion we can do!
To generalize, say we have teams in groups in different ways. We can have teams in groups by adding a team to any of the existing groups, giving ways, and we can have teams in groups by adding a team alone in different locations, giving ways.
Now, let us start a recursion. Let be the number of ways teams can place into spots, and define and if . By our earlier logic, For the base case, we can see that . Let us make a table, where goes down the side and is on the top:
To finish, we simply fill in values (don't mess up here!): and the answer is .
Problems:
Find the number of ordered partitions of where an ordered partition of is a tuple of positive integers such that .
A mail carrier delivers mail to the nineteen houses on the east side of Elm Street. The carrier notices that no two adjacent houses ever get mail on the same day, but that there are never more than two houses in a row that get no mail on the same day. How many different patterns of mail delivery are possible? (AIME)
In how many ways can 7 teams place in a tournament if ties are allowed? Try this problem with a single recursion that doesn't depend on groups. Hint: use more than one previous value in the recursion.
See here.
Next week, I will write a post about recursion in computer science.
In two weeks, we will learn how to solve expressions such as , which are called recurrence relations.
If you want more problems to work on, you can look up #RecurrenceRelations.
Easy Math Editor
This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.
When posting on Brilliant:
*italics*
or_italics_
**bold**
or__bold__
paragraph 1
paragraph 2
[example link](https://brilliant.org)
> This is a quote
\(
...\)
or\[
...\]
to ensure proper formatting.2 \times 3
2^{34}
a_{i-1}
\frac{2}{3}
\sqrt{2}
\sum_{i=1}^3
\sin \theta
\boxed{123}
Comments
Great Post!
Log in to reply
Yup! Nice post! I have learnt sth new today but will have to digest the second part further... (it's quite content-filled!) :)
Log in to reply
Yes, the second part is a very powerful technique that allows you to solve many problems that suggest horrible casework, and brilliant has a lot of those. Basically, you split each case into several parts which don't overlap, but cover all cases, and then find a recurrence for each one that depends on the previous ones. The connections can be slightly unintuitive.
One thing that would help is if I actually knew the name of the technique. Does anyone know the name? I feel like I've heard recursion states before but I can't find that when I look it up.
Log in to reply
Log in to reply
Fantastic! A bit on the lengthy side, but very informative nonetheless. Many will benefit.
Great first post to start your "business" up!
Looking forward to more of your posts.
Great post!
very interesting post
hi daniel! can you tell me how i can increase my mathematical thinking ability? any comment is much appreciated!
Log in to reply
I find that practicing math competition problems, for example the AMC 8, the AMC 10, the AMC 12, and other competitions help a lot.
Log in to reply
Seconded. Also, I think that trying problems one step above your "comfort zone" or problems you have little difficulty with is a good way to improve.
Log in to reply
Log in to reply
Log in to reply