I want to c.reate a matrix that will be N times N, where here N=7 but th. e the entries to be with metropolis Hastings algorithm.
As the picture suggests:
So r(x,y)=1/7

and p(x,y) =r(x,y) \min(\frac{\pi(y)}{\pi(x)},1)

For example the p(1,2) = 1/7 \cdot \min(\frac{1/8}{1/4},1) =1/14

p(1,3) = 1/7 \cdot \min(\frac{1/6}{1/4},1) =2/21 apart from the entry p(1,1) = 1-\sum_{i=2}^{j=7}p(i,j).
This sum will be in all the diagonal entries.

For diagonal items, your indexes are i and j, but inside you have p(x,y). See your p(1,1). What would be p(2,2) and p(3,3) and so on. Can you please clarify?

p(i,j).I corrected it.The diagonal entries must have 1-sum(the values of the same row) .For example if row 4 is:
1,2,3,x,5,6,7 then x=1-sum(1,2,3,5,6,7)