<s>[INST] Finding bivariate probability mass function (by counting?) Suppose that we role $d$ dice. Let $X, Y$ be random variables, where 
$X = \#$ rolled by the die with the highest value. 
$Y = \#$ rolled by the die with the second highest value.
By convention, we allow for the possibility that $X=Y$ in case more than one die has the same value (e.g. in a scenario where two dice roll a $6$ and $(d-2)$ dice roll values lower than $6$). 
We want to find the probability mass function $P(X=x, Y=y)$. Clearly, $y \le x$, so this eliminates some cases.
\begin{array}{|c|c|c|c|c|c|c|}
\hline
& x = 1 & x = 2 & x = 3 & x= 4 & x = 5 & x=6 \\ \hline
y = 1 & & &\\ \hline
y = 2 & 0  & &\\ \hline
y = 3 & 0 & 0 &\\ \hline
y = 4 & 0 & 0 & 0\\ \hline
y = 5 & 0 & 0 & 0 & 0\\ \hline
y = 6 & 0 & 0 & 0 & 0 & 0\\ \hline
\end{array}
Basically we want to complete this table. There may be many elegant ways to do this, but I only thought of counting outcomes. For example, there is only one outcome such that $P(X=1, Y=1)$, namely the case in which all dice have the value $1$. This probability is $\displaystyle \frac{1}{6^d}$ (unless I am doing something terribly wrong). Therefore:
\begin{array}{|c|c|c|c|c|c|c|}
\hline
& x = 1 & x = 2 & x = 3 & x= 4 & x = 5 & x=6 \\ \hline
y = 1 & \displaystyle \frac{1}{6^d} & &\\ \hline
y = 2 & 0  & &\\ \hline
y = 3 & 0 & 0 &\\ \hline
y = 4 & 0 & 0 & 0\\ \hline
y = 5 & 0 & 0 & 0 & 0\\ \hline
y = 6 & 0 & 0 & 0 & 0 & 0\\ \hline
\end{array}
Of course, this was the easy part. Now, to compute $P(X=2, Y=1)$ we consider the outcomes in which one die has value $2$ and all the others have value $1$. Now this part is the one that I am not sure about (I am not very good --a.k.a. terrible -- with counting arguments). My idea is that since we have $d$ dice there are $d$ for us to get one die has value $2$ and all the others have value $1$. So eventually $P(X=2, Y=1) = \displaystyle \frac{d}{6^d}$. This is the same probability $P(X=3, Y=1)$, $P(X=4, Y=1)$
\begin{array}{|c|c|c|c|c|c|c|}
\hline
& x = 1 & x = 2 & x = 3 & x= 4 & x = 5 & x=6 \\ \hline
y = 1 & \displaystyle \frac{1}{6^d} & \displaystyle \frac{d}{6^d} & \displaystyle \frac{d}{6^d}& \displaystyle \frac{d}{6^d} & \displaystyle \frac{d}{6^d} & \displaystyle \frac{d}{6^d}\\ \hline
y = 2 & 0  & &\\ \hline
y = 3 & 0 & 0 &\\ \hline
y = 4 & 0 & 0 & 0\\ \hline
y = 5 & 0 & 0 & 0 & 0\\ \hline
y = 6 & 0 & 0 & 0 & 0 & 0\\ \hline
\end{array}
Finally, to consider a harder case, something like $P(X=4, Y=3)$. This is the event in which one die has value $4$, one has value $3$ and the rest can have any value among $\{1, 2, 3\}$. There are $d$ ways to get a $4$ in one of the dice, $(d-1)$ ways to get a $3$ (since one die must be a $4$) and $3^{(d-2)}$ possibilities for the remaining dice. So the probability is eventually $\displaystyle \frac{d(d-1)3^{d-2}}{6^d}$. 
Are these counting arguments correct (or, for that matter, my proposed approach) or am I missing something in this process? All comments are greatly appreciated.
 [/INST] You've neglected the possibility of ties and are over counting events where multiple dice equal $y$.

You wish to calculate the probability that two dice are $x$ and $y$ and none of the remaining die are higher than $y$.
There are two cases to consider.  When $x=y$ and when $x>y$


*

*When $x=y$ you want the probability that all dice are at most $x$, minus the probability that one dice equals $x$ and all the rest are less.

*When $x>y$ you want the probability that one die equals $x$ and all the rest are at most $y$ minus the probability that one die equals $x$ and all the rest are less than $y$.


 $$\begin{align}\mathsf P(X=x,Y=y) & =\begin{cases} { \mathsf P(\bigcap\limits_{k\in\{1..d\}} Z_k\le x) \\- \prod\limits_{i=1}^d \mathsf P(Z_i=x,\bigcap\limits_{k\in\{1..d\}\setminus\{i\}} Z_k< x) }& : x\in\{1..6\}, y=x\\[2ex]\hdashline{ \prod\limits_{i=1}^d~\mathsf P(Z_i=x, \bigcap\limits_{k\in\{1..d\}\setminus\{i\}} Z_k\le y) \\ - \prod\limits_{i=1}^d~\mathsf P(Z_i=x, \bigcap\limits_{k\in\{1..d\}\setminus\{i\}} Z_k< y) } & : x\in\{2..6\}, y\in \{1..x-1\}\\[2ex]\hdashline 0 & :\textsf{elsewhere}\end{cases}\\[4ex]& =\begin{cases} {(\tfrac x 6)}^d - \tfrac d 6~{(\tfrac {x-1}6)}^{d-1} & : x\in\{1..6\}, y=x\\[2ex]\hdashline \tfrac d6~{(\tfrac y 6)}^{d-1} - \tfrac d6~{(\tfrac {y-1} 6)}^{d-1} & :x\in\{2..6\}, y\in \{1..x-1\}\\[2ex]\hdashline 0 & :\textsf{elsewhere}\end{cases}\end{align}$$

</s>