Easier way to solve conditional probability question? Two digits are chosen at random from a table of random numbers containing the digits 0,1,2,...,9. Find the probability that the second number is 2, given that the sum is of the two numbers is greater than 7.
Now, thats my solution:
A = 2nd number is 3.
B = sum is greater than 7.
P(A|B) = $\frac{P(A\cap B)}{P(B)}$
$P(A\cap B)$ equals to $\frac{4}{100}$ simply by calculating all possible successful events.
In order to calculate P(B) I used complementary event $P(\overline{B})$ and then by drawing a table of all possible variations like (0,0),(0,1),(0,2),...,(7,0) found that there are 36 possible choices.
And so the answer is $\frac{1}{16}$ 
My question is what do I do if there are say not 10 numbers, but say 40 and we are asked to calculate similar probability of an event where the sum is greater than 28 or something. I mean there is no way to calculate it the way I did it. Is there any standart method for these kind of problems?
I apologize in advance if the answer is very simple and I just dont see it, as I'm new to this topic. 
 A: When we are calculating conditional probabilities by the technique you used, we need to calculate certain probabilities. There is no universal recipe for this, but let us look at the particular problem you mentioned. We have two numbers chosen, in order, "with replacement" from the set $\{0,1,\dots,39\}$. We want the probability that the sum of the first and the second is greater than $28$, that is, $29$ or more. 
There are $40^2$ ordered pairs of numbers, all equally likely. 
As in your calculation, it is easier to count the complement, the event that the sum is $28$ or less.
If the first is $0$, we have $29$ possibilities for the second, $0$ to $28$.
If the first is $1$, we have $28$ possibilities for the second.
This continues, until if the first is $28$, there is only one possibility for the second.
Thus the number of possibilities is $29+28+\cdots +1$. By the usual formula for the sum of an arithmetic series, the sum is $(29)(30)/2$. 
A: Additional remark to André´s post.
If you want to know how much pairs have a leading 2 (A) and and the sum of the numbers is greater than 28 you just count them:
$(2,27);(2,28);...;(2,40)$
So there are 14(=40-27+1) pairs, which fullfill the conditions A and B.
A: Drawing pairs from $\{0, 1, .. 9\}$ with repetition:
Count of $A$: pairs with a sum greater than 7: $\sum\limits_{x=0}^8\sum\limits_{y=8-x}^9 1 + \sum\limits_{b=0}^9 1 = 64$
Count of $A\cap B$: pairs with a sum greater than 7, whose second member is '2': $\sum\limits_{x=6}^9 1 = 4$
$$\Pr(B\mid A) = \frac{1}{16}$$

Drawing pairs from $\{0, 1, .. 39\}$ with repetition:
Count of $A'$: pairs with a sum greater than 28: $\sum\limits_{x=0}^{29}\sum\limits_{y=29-x}^{39} 1 + \sum\limits_{x=30}^{39}\sum\limits_{y=0}^{39} 1 = 865$
Count of $A'\cap B'$: pairs with a sum greater than 28, whose second member is '2': $\sum\limits_{x=27}^{39} 1 = 13$
$$\Pr(B'\mid A') = \frac{13}{865}$$

Uses: $\sum\limits_{x=m}^n 1 = (n-m)+1, \quad \sum\limits_{x=m}^n x = \tfrac 1 2 (n-m+1) (n+m)$
Edit: You can also break the domains into rectangles and triangles.
