# Probability [Sum of digits is even for a random number] [closed]

A number of 6 digit numbers is written down at random. Probability that the sum of the digits is an even number is? Please answer with explanation.

-

## closed as off-topic by Matthew Conroy, TMM, mookid, TooTone, Lost1Mar 18 '14 at 21:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – Matthew Conroy, TMM, mookid, TooTone, Lost1
If this question can be reworded to fit the rules in the help center, please edit the question.

Does the first digit have to be nonzero? I would assume yes since you said number but it is better to be clear. – John Habert Mar 18 '14 at 16:41
Its not given in the question. So, lets assume the first digit to be non-zero. – toothie Mar 18 '14 at 16:44
If we have five digits given, then note that we can extend those five digits with a sixth. How does this process of extending the number affect parity? – Bulberage Mar 18 '14 at 16:50
What have you tried so far? – Steven Stadnicki Mar 18 '14 at 16:50
@BenCrowell You might be interested in the notion of Natural Density of a set of natural numbers ( en.wikipedia.org/wiki/Natural_density ). By that metric, there's a well-defined answer to your alternate question question; using the techniques in any of this question's answers the limit is easily seen to be $\frac12$, since for all $n$ the number of $m\leq n$ with even digit-sum is within one of $\frac n2$. – Steven Stadnicki Mar 18 '14 at 20:29

The result is independent of whether the first digit has to be zero or not. By the same logic as my answer here, the answer is immediately seen to be $\frac12$.

-
The answer is 1/2. But, could you please explain. – toothie Mar 18 '14 at 16:53
@Monique: Did you look at the link I provided? That has explanation enough. – TonyK Mar 18 '14 at 16:55
ok, got it. Thanks :D – toothie Mar 18 '14 at 16:57

Let $p_n$ be the probability that an $n$-digit number has even parity.

We see that $p_1 = {1 \over 2}$.

Suppose we are given an $n$ digit number and add one digit. Then there are two ways the $n+1$ digit number can have even parity: (1) The $n$ digit number has even parity and the new digit is even, and (2) the $n$ digit number has odd parity and the new digit is odd.

Then $p_{n+1} = {1 \over 2} p_n + {1 \over 2} (1- p_n) = { 1 \over 2}$.

-
$\frac12$ is intuitively obvious too. :) I doubt OP will understand the recurrence. :p – Sabyasachi Mar 18 '14 at 16:53
@Sabyasachi: I will elaborate a little. – copper.hat Mar 18 '14 at 16:53
yeah that's good. :) – Sabyasachi Mar 18 '14 at 16:54
+1 for recurrence. although i still don't see why we are calculating anything at all. even and odd are obviously evenly distributed. (yes I make terrible puns) – Sabyasachi Mar 18 '14 at 16:55
I think is it good to look at the same problem in different ways. I have often made mistakes with what was in hindsight obvious. – copper.hat Mar 18 '14 at 16:57

Hint: think of choosing the first five digits, then the last digit. If the sum of the first five digits is odd, the sixth digit has to be odd to make the sum of all six even. What is the chance of this? If the sum of the first five is even,....

-
Yes, that's how I started. But, then there would be many ways of choosing the first five digits so that sum is odd and same for even sum. So, I couldn't figure out. – toothie Mar 18 '14 at 16:56
The point is that it doesn't matter how many ways there are to pick the first five digits. Whether the sum of the first five is odd or even, the chance the sum of the six is even is $\frac 12$ – Ross Millikan Mar 18 '14 at 17:20

Let $p$ be the probability that the sum of the first (leftmost) five digits is even. Then the probability that the sum of the first five digits is odd is $1-p$.

Now let us find the probability that the sum of all the digits is even. This can happen in two disjoint ways: (i) The sum of the first five is even, and the last is even or (ii) the sum of the first five is odd, and the last is odd.

The probability of (i) is $(p)(1/2)$. The probability of (ii) is $(1-p)(1/2)$. Add. We get $1/2$.

Remark: There is more "bijective" way of seeing this. Let $E$ be the set of numbers with even digit sum, and $O$ the set of numbers with odd digit sum.

If $e$ is a digit string in $E$, let $\varphi(e)$ be the digit string obtained by replacing the last digit of $e$ by $9$ minus the last digit of $e$.

Then $\varphi(e)$ has odd digit sum, and all numbers in $O$ can be obtained in this way. It follows that $E$ and $O$ have the same size.

-

Hint: Note down all the cases where a $6$ digit number can have its sum of digits even.

$1.$ All $6$ digits even: Is this possible? Yes. With repetition.

$2.$ $4$ digits even($2$ digits odd): Is this possible? Yes. With/Without repetition.

$3.$ $2$ digits even($4$ digits odd): Is this possible? Yes. Yes. With/Without repetition.

$4.$ $6$ digits odd. Is this possible? Yes. With repetition.

-
Why do you think the digits must be different? – Ross Millikan Mar 18 '14 at 16:48
the final answer will be? – toothie Mar 18 '14 at 16:50
@Monique you need to do that yourself. – Sabyasachi Mar 18 '14 at 16:51
@Monique you really should exhibit some work yourself, that would give us some reason to give more hints, if needed – gt6989b Mar 18 '14 at 16:51
@gt6989b precisely – Sabyasachi Mar 18 '14 at 16:52