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

You are not logged in.

## #1 2013-09-20 13:16:14

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,581
Website

### 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'
I'm not crazy, my mother had me tested.

Offline

## #2 2013-09-20 20:06:17

bob bundy
Moderator
Registered: 2010-06-20
Posts: 7,763

### 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

Children are not defined by school ...........The Fonz
You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei

Offline

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

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: Combinatorics

Hi Bob

That is not going to yield a correct answer.

Hi Agnishom

Are pens of same color the same or different?

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

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

bob bundy
Moderator
Registered: 2010-06-20
Posts: 7,763

### 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

Children are not defined by school ...........The Fonz
You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei

Offline

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

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### 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 00:18:29)

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

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

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,581
Website

### 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'
I'm not crazy, my mother had me tested.

Offline

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

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,581
Website

### 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'
I'm not crazy, my mother had me tested.

Offline

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

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### 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.

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

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

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: Combinatorics

Hi Agnishom

I checked the answer with them and it is correct.

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #10 2013-09-21 03:54:21

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,581
Website

### 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'
I'm not crazy, my mother had me tested.

Offline

## #11 2013-09-21 04:06:37

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### 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.

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #12 2013-09-21 04:09:04

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 107,776

### Re: Combinatorics

Hmmm.

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #13 2013-09-21 04:35:59

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### 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.

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #14 2013-09-21 04:40:45

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 107,776

### 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.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #15 2013-09-21 04:42:25

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: Combinatorics

I have two solutions. Classic casework and the GF.

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #16 2013-09-21 04:47:08

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 107,776

### 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.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #17 2013-09-21 04:53:49

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: Combinatorics

bobbym wrote:

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

What?

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #18 2013-09-21 04:58:57

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 107,776

### 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.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #19 2013-09-21 05:12:39

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: Combinatorics

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

Have you programmed it?

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #20 2013-09-21 05:17:50

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 107,776

### 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.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

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

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: Combinatorics

Can you post the code you currently have?

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #22 2013-09-21 05:24:55

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 107,776

### Re: Combinatorics

``````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.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #23 2013-09-21 05:30:09

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: Combinatorics

The definition of ans2 is incorrect.

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #24 2013-09-21 05:33:29

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 107,776

### Re: Combinatorics

What would you do from there?

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #25 2013-09-21 05:42:15

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### 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?

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline