# Find formulae for $P(X=x)$ and $P(Y=y)$ in terms of $f$ and $g$

Suppose that random variables $X$ and $Y$, each with a finite number of possible values, have joint probabilities of the form $$P(X=x, Y=y) = f(x)g(y)$$ for some functions $f$ and $g$. How in the world would you find formulae for this? That doesn't even make sense.

-

We have \begin{align*} P(X=x) &= \sum_y P(X=x, Y=y)\\ &= \sum_y f(x)g(y)\\ &= f(x) \cdot \sum_y g(y) \end{align*} and analogously \begin{align*} P(Y=y) &= \sum_x P(X=x, Y=y)\\ &= \sum_x f(x)g(y)\\ &= g(y) \cdot \sum_x f(x) \end{align*} Summing over all $x$ and $y$ gives $1 = \sum_x\sum_y f(x)g(y) = \sum_x f(x) \cdot \sum_y g(y)$ So $P(X=x) = \frac{f(x)}{\sum_{x'} f(x')}, \quad P(Y=y) = \frac{g(y)}{\sum_{y'} g(y')}-$
@martini Yes I definitely agree with Alex this is an outstanding answer thanks. Just one question. What is the last step you did there in the very last line? When you put $P(X=x) = \frac {f(x)}{\sum_x' f(x')}$ Where did the summation of $f(x')$ come from? –  TheHopefulActuary Oct 16 '12 at 2:49
@Kyle When we summed over $x$ and $y$ the line before, we concluded that $(\sum_x f(x))^{-1} = \sum_y g(y)$. We want to use that in $P(X=x) = f(x) \cdot \sum_y g(y)$. There is an $x$ in this equation, so I renamed the summation variable in $\sum_{x'} f(x')$ and got $f(x) \cdot \sum_y g(y) = f(x) \cdot (\sum_{x'} f(x'))^{-1}$ –  martini Oct 16 '12 at 4:56