# Rule of Sum

How to use the rule of sum to find the number of ways: formula, 3 examples, and their solutions.

## Formula

### Formula

If the number of ways to do A is n1,
the number of ways to do B is n2,
the number of ways to do C is n3,
...
then the number of ways
to do [A or B or C or ...] is
N = n1 + n2 + n3 + ... .

This is the rule of sum.
(one of the counting principle)

## Example 1

### Solution

From 1 to 10,
the even numbers are
2, 4, 6, 8, and 10.

So the number of ways
to pick an even number is
5.

## Example 2

### Solution

Draw the wanted cases in this form:
(big die, small die).

Think of the cases when
[big die] + [small die] = 9.

Don't forget that
the number of a die is 1 ~ 6.

3 + 6 = 9
So (3, 6) is the wanted case.

4 + 5 = 9
So (4, 5) is the wanted case.

5 + 4 = 9
So (5, 4) is the wanted case.

6 + 3 = 9
So (6, 3) is the wanted case.

So the number of ways
to get a sum of 9 is
4.

## Example 3

### Example

In the given map,
there's an disconnected part.
(the middle of the map)

Then find the number of shortest paths
by adding the number of cases.

If the lines are all connected,
solve the example like this.

### Solution

To make the shortest path,
you should move
either → (left) or ↓ (downward).

Find the number of ways
to move to the next adjacent point.

The number of ways
to move to this point is
1.

The number of ways
to move to this point is
1.

The number of ways
to move to this point is
1.

The number of ways
to move to this point is, 1 + 1,
2.

The number of ways
to move to this point is, 2 + 1,
3.

The number of ways
to move to this point is
1.

The number of ways
to move to this point is, 3 + 1,
4.

The number of ways
to move to this point is
1.

The number of ways
to move to this point is, 1 + 2,
3.

The number of ways
to move to this point is
1.

The number of ways
to move to this point is, 1 + 3,
4.

The number of ways
to move to this point is
3.

The number of ways
to move to this point is, 4 + 3,
7.

The number of ways
to move to this point is, 3 + 4,
7.

The number of ways
to move to this point is, 7 + 7,
14.