Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

## #1 2013-09-21 11:16:14

Agnishom
Real Member

Offline

### Combinatorics

There are 2 types of red pens, 3 types of blue pens, and 4 types of green pens.
You want to purchase 4 pens, each of a different type, containing at least one of each color.

In how many ways can you do this?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
'The whole person changes, why can't a habit?' -Alokananda

## #2 2013-09-21 18:06:17

bob bundy
Moderator

Offline

### Re: Combinatorics

There are 2 types of red pens, 3 types of blue pens, and 4 types of green pens.
You want to purchase 4 pens, each of a different type, containing at least one of each color.

Let's say you have these colours red1, red2, blue1, blue2, blue3, green1, green2, green3, and green4.  That's nine colour choices.

So choose a red, then a blue, then a green .... how many ways  ?

Then choose anything as the fourth pen out of the 6 remaining choices.

Bob

You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei

## #3 2013-09-21 19:32:34

anonimnystefy
Real Member

Offline

### Re: Combinatorics

Hi Bob

That is not going to yield a correct answer.

Hi Agnishom

Are pens of same color the same or different?

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #4 2013-09-21 20:47:47

bob bundy
Moderator

Offline

### Re: Combinatorics

My first attempt at this question interpreted the problem differently. Then I deleted it and tried again.  Now I'm not sure.  We await Agnishom's clarification.

Bob

You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei

## #5 2013-09-21 20:54:09

anonimnystefy
Real Member

Offline

### Re: Combinatorics

I'd say the answer is 3 if same-coloured pens are the same and 72 if they are different.

The GFs are:

and

Last edited by anonimnystefy (2013-09-21 22:18:29)

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #6 2013-09-21 22:13:06

Agnishom
Real Member

Offline

### Re: Combinatorics

I think they are different

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
'The whole person changes, why can't a habit?' -Alokananda

## #7 2013-09-21 22:19:05

Agnishom
Real Member

Offline

### Re: Combinatorics

#### bob bundy wrote:

There are 2 types of red pens, 3 types of blue pens, and 4 types of green pens.
You want to purchase 4 pens, each of a different type, containing at least one of each color.

Let's say you have these colours red1, red2, blue1, blue2, blue3, green1, green2, green3, and green4.  That's nine colour choices.

So choose a red, then a blue, then a green .... how many ways  ?

Then choose anything as the fourth pen out of the 6 remaining choices.

Bob

So, it should be 2*3*4*6 = 144. But why is it 72?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
'The whole person changes, why can't a habit?' -Alokananda

## #8 2013-09-21 22:24:07

anonimnystefy
Real Member

Offline

### Re: Combinatorics

I already said that isn't correct. If you did it like that, you would count picking red1, red2, blue1, green1 and red2, red1, blue1, green1 as different picks, when they are truly the same.

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #9 2013-09-21 22:32:34

anonimnystefy
Real Member

Offline

### Re: Combinatorics

Hi Agnishom

I checked the answer with them and it is correct.

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #10 2013-09-22 01:54:21

Agnishom
Real Member

Offline

### Re: Combinatorics

#### anonimnystefy wrote:

I already said that isn't correct. If you did it like that, you would count picking red1, red2, blue1, green1 and red2, red1, blue1, green1 as different picks, when they are truly the same.

I am sorry, I could not follow. How is it coming to 72?

I too checked that it is correct

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
'The whole person changes, why can't a habit?' -Alokananda

## #11 2013-09-22 02:06:37

anonimnystefy
Real Member

Offline

### Re: Combinatorics

You can do it by casework or using the GF above.

If you did it by casework you'd do it by choosing one colour and calculating the number of possibilities in which you buy two lens of that colour and one pen of each other colour. Then do that for the two other colour and sum them. The result should be: 1*3*4+2*3*4+2*3*6=72.

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #12 2013-09-22 02:09:04

bobbym

Online

### Re: Combinatorics

Hmmm.

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #13 2013-09-22 02:35:59

anonimnystefy
Real Member

Offline

### Re: Combinatorics

I don't know how I would program this one, and it's a simple enough a problem that it doesn't need to be programmed.

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #14 2013-09-22 02:40:45

bobbym

Online

### Re: Combinatorics

Hmmm.

I don't know how I would program this one

So then it is not so simple. DZ says you do not understand the problem until you program it. This always lends insight and satisfies the "two solution rule."

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #15 2013-09-22 02:42:25

anonimnystefy
Real Member

Offline

### Re: Combinatorics

I have two solutions. Classic casework and the GF.

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #16 2013-09-22 02:47:08

bobbym

Online

### Re: Combinatorics

And if the problem were say 20 pens and 16 to 1 types would you still want to casework it?

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #17 2013-09-22 02:53:49

anonimnystefy
Real Member

Offline

### Re: Combinatorics

#### bobbym wrote:

And if the problem were say 20 pens and 16 to 1 types

What?

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #18 2013-09-22 02:58:57

bobbym

Online

### Re: Combinatorics

What I am saying is casework is a very clumsy way of working sufficient for small problems only.

You are right, it is difficult to program though.

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #19 2013-09-22 03:12:39

anonimnystefy
Real Member

Offline

### Re: Combinatorics

I know, I dislike casework, too, but tend to use it if it seems possible.

Have you programmed it?

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #20 2013-09-22 03:17:50

bobbym

Online

### Re: Combinatorics

Yes I did. But it refuses to get the answer I want.

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #21 2013-09-22 03:20:54

anonimnystefy
Real Member

Offline

### Re: Combinatorics

Can you post the code you currently have?

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #22 2013-09-22 03:24:55

bobbym

Online

### Re: Combinatorics

#### Code:

```s = {{r, 1}, {r, 2}, {b, 1}, {b, 2}, {b, 3}, {g, 1}, {g, 2}, {g,
3}, {g, 4}};
ans = Permutations[s, {4}];
ans1 = Select[ans, Length[Union[#[[All, 1]]]] >= 3 &];
ans2 = Select[ans1, Length[Union[#[[All, 2]]]] == 4 &];
Union[Sort[#] & /@ ans2]```

This is the output

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #23 2013-09-22 03:30:09

anonimnystefy
Real Member

Offline

### Re: Combinatorics

The definition of ans2 is incorrect.

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #24 2013-09-22 03:33:29

bobbym

Online

### Re: Combinatorics

What would you do from there?

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #25 2013-09-22 03:42:15

anonimnystefy
Real Member

Offline

### Re: Combinatorics

What did you try to do to get ans2, ie. what did you think Select[ans1, Length[Union[#[[All, 2]]]] == 4 &]; would do?

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment