TITLE: probability of A dice with X faces beating B dice with Y faces
QUESTION [7 upvotes]: I am looking for a formula to determine the probability of a A Die with X faces rolling higher than B die with Y faces. 
An example would be: what is the probability of 4d10 rolling greater than 3d12
Edit: I thought the last edit summary would pop up but it didnt, so added here. Corrected the question a bit and added example.
Edit #2: I had come up with a similar conclusion for percentages (x-1/2y) in a case of dx vs dy
But I didnt took into account the difference on whether "x" was larger or smaller than "y". 
However what about when there is more than one dice of the same type is it still the same formula? considering the sum is a bit more irregular since some numbers repeat more often than others do I replace "x" and "y" with the total sum of possible outcomes of each die combination? (in xda I assume the total is a^x)

REPLY [2 votes]: We obtain separate formulas for the case $X\le Y$ and $X\ge Y$.
It is useful to calculate first the  probability that if two dice have the same number $N$ of faces, then the first die beats the second. With probability $\dfrac{1}{N}$ the results are the same, so with probability $1-\dfrac{1}{N}=\dfrac{N-1}{N}$ they are different. If they are different, by symmetry the probability the first is higher is $\dfrac{1}{2}$. So the probability the first die gives a number higher than the second is 
$$\dfrac{N-1}{2N}.$$ 
Call this result the Basic Fact. 
Case 1: $X \le Y$. With probability $\dfrac{X}{Y}$, the result on the second die is $\le X$. Given that the result on the second die is $\le X$, by the Basic Fact, the probability the result on A is bigger than the result on B is $\dfrac{X-1}{2X}$.
It follows that the probability the A die wins is, in this case, $\dfrac{X}{Y}\cdot \dfrac{X-1}{2X}$. This simplifies to 
$$\dfrac{X-1}{2Y}.$$
Case 2: $X \ge  Y$. Here A can win in $2$ ways. If A rolls a number $\gt Y$, there is an automatic win. The probability of this is $\dfrac{X-Y}{X}$. If A rolls a number $\le Y$, which has probability $\dfrac{Y}{X}$, then by the Basic Fact the probability A wins is $\dfrac{Y-1}{2Y}$. So our probability is
$$\frac{X-Y}{X}+\frac{Y}{X}\cdot \frac{Y-1}{2Y}.$$
This can be simplified to 
$$1-\frac{Y+1}{2X}.$$