'Is calculating the number of binary or hexadecimal possibilities a combination or permutation problem? Or neither?

So in early CS I learned that binary of length 2 has 2^2 possible combinations (00 01 10 11) And binary of length 3 has 2^3 possible combinations (001, 010, 100,...)

I've been thinking it's either a permutation or combination problem, but when plugging these values into the formulas for comb. or perm. it gives different answer for some cases.

Can you please explain what I'm misunderstanding?



Solution 1:[1]

It's a combinatorics problem. You're looking for the number of elements in a Cartesian product. The set of numbers that can be written with n bits where each bit is in {0, 1} is the Cartesian product of {0,1} with itself, n times, also-called the nth Cartesian power.

Note that the way the words "permutations" and "combinations" are used in programming, although somewhat standardized, is relatively new, and comes from the necessity of giving short explicit names to functions in programming libraries. It's not at all standard math linguo - "permutations" has a very specific meaning in math, which is not the same as used in programming libraries; and "combinations" has a very loose and broad meaning in math, which include everything that is referred to in programming as combinations with replacement, combinations without replacement, permutations, and elements of Cartesian product.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Stef