If X and Y are two discrete r.v’s with joint probability function f(x,y), then the conditional probability function Y given X, f(y|x) is given by (STA301)

f(yj | xi) = f(xi, yj) / g( xi)
f(yj | xi) = f(xi, yj) / h( yj)
f(yj | xi) = f(xi, yj) / Sum of g( xi)
f(yj | xi) = f(xi, yj) / sum of h( yj)