I am reading Bayesian Reasoning And Machine Learning and I'm not sure how to do exercise 4.6 on p.80.
The undirected graph:
represents a Markov network with nodes $x1, x2, x3, x4, x5$, counting clockwise around the pentagon with potentials $\phi(x_i,x_j)$. Show that the joint distribution can be written as $$p(x_1,x_2,x_3,x_4,x_5)=\frac{p(x_1,x_2,x_5)p(x_2,x_4,x_5)p(x_2,x_3,x_4)}{p(x_2,x_5)p(x_2,x_4)}$$
What I have tried so far:
We have that \begin{align} \frac{p(x_1,x_2,x_5)p(x_2,x_4,x_5)p(x_2,x_3,x_4)}{p(x_2,x_5)p(x_2,x_4)} &= \frac{p(x_1|x_2,x_5)p(x_2,x_5))p(x_5|x_2,x_4)p(x_2,x_4)p(x_2|x_3,x_4)p(x_3|x_4)p(x_4)}{p(x_2,x_5)p(x_2,x_4)} \\ &=p(x_1|x_2,x_5)p(x_5|x_4)p(x_2|x_4)p(x_3|x_4)p(x_4) \\ &=p(x_1|x_2,x_5)\phi(x_4,x_5)\phi(x_2,x_3)\phi(x_3,x_4)p(x_4) \end{align}
I'm not sure how to factorize it any further. Could anyone please help?