Question: Convolution of random variables with P[X=x]=x/10, x =1,2,3,4

Let X be a random such that P[X=x]=x/10, x =1,2,3,4

And let S be the sum 

I want to calculate probabilities like P[S=2] where S is the sum of 2 independent random variable that are distributed like X. The solution should be P[S=2]=P[X=1]*P[X=1]=1/10*1/10=1/100. Or P[S=3]=P[X=1]*P[X=2]+P[X=2]*P[X=1]=4/100

I need this not only for 2 summands but also for 3 and 4 summands. 

How can I code this? I struggle to write a code so that X the random variable has the desired probabilities. Thanks in advance!

 

Thanks in advance

Please Wait...