%% (a)
x = 0:5; pX = (binopdf(x,5,1/3));
y = 0:7; pY = (binopdf(y,7,4/5));
%% (b)
P = pX'*pY;
%% (c)
% (c.i)
pX = sum(P,2)';
pY = sum(P);
EX = x*pX'
% (c.ii)
[X Y] = meshgrid(x,y); X = X'; Y = Y';
PXeqY = sum(sum((X == Y).*P))
% (c.iii)
PXY6 = sum(sum((X.*Y < 6).*P))