This analogy doesn't allow you to use all three shirts and no pants or no ties. I mean... you could, but then why bother with clothes?

Yeah that's what I was thinking.You have three independent choices and three things to choose from for each choice. So yes, it is 3^3.

What if you got two 3 balls? Or 3 twos? Then it would be 27 again.But the order-independent version can be thought to be equivalent to the following:

You have a giant(infinite) vat of ping-pong balls numbered 1 to 3, and choose 3 ping pong balls from there. You subsequently forgot which order you chose them. How many distinguishable possibilities are there?

It is 10, like Urchin mentioned,I actually have been toying with things like this (binary mostly though) and you're right. I do like that kind of math, if any. It's a really layered math - fun for Ne and/or Ti.but how do you do it more generally? With choosing r balls from n types of balls? That is an interesting question, imo.

The short answer is it is C(n+r-1,r), where C is the choose function.

I tried typing the "star" and "bar" explanation but I didn't like the formating.

So, here is a link.

Nocapszy, if you like these types of questions you'll like Discrete Math (which is the mathematics behind computer science).

Thank you.The following source has explanations of the basics.

Discrete Math Project - Permutations with Repetition

Also note, that these basics come in four flavors:

1)permutations without replacement

2)combinations without replacement

3)permutations with replacement

4)combinations with replacement

You'll find that transforming your counting problem into one of these is the most likely source of answers. That along with generating functions will fulfill most people's combinatorics type questions.