# Thread:

1. ## Probability that a random k-digit number contains at least one 0, 1, and 2

Let $k\geq 3$ be any given integer. What is the probability that a random k-digit number will have at least one 0, at least one 1, and at least one 2?

I'm thinking that this could be answered via the principle of inclusion-exclusion, but I could use some clarification (or possible correction). Here's what I've got so far.

Assuming that leading zeroes are not allowed,
# of k-digits containing no 0’s: $9^k$
# of k-digits containing no 1’s: $8×9^{k-1}$
# of k-digits containing no 2’s: $8×9^{k-1}$
# of k-digits containing no 0’s and no 1’s: $8^k$
# of k-digits containing no 0’s and no 2’s: $8^k$
# of k-digits containing no 1’s and no 2’s: $7×8^{k-1}$
# of k-digits containing no 0’s, 1’s or 2’s: $7^k$

I then applied the following:
$|A\cup B\cup C|=|A|+|B|+|C|-|A\cap B|-|A\cap C|-|B\cap C|+|A\cap B\cap C|$
This would obtain the complement set of what I'm looking for, so this would be subtracted from $9×10^{k-1}$.

Am I on the right track?

2. You are.

3. Thanks for confirming that.

I currently have the answer written out as follows:
$P=(9×10^{k-1} )-[9^k+2(8×9^{k-1})-2(8^k)-(7×8^{k-1})+7^k]$
This probably isn't the cleanest way to show the answer. Is there a more condensed version I could use?

4. There is probably no shorter formula for this case.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 11, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.8994777798652649, "perplexity_flag": "middle"}