Dear Student
We know solubility product
Ksp = [A]a[B]b
Where A and B are the concentration and a and b are the coefficients.
Now among A and B if any one is H+ or OH- then we can find out pH of the solution.
e.g.
Mg(OH)2 ⇌ Mg2+ + 2OH¯
​Its solubility product
Ksp = [Mg2+] [OH¯]2
If Ksp is given then we can find out [OH¯]
When the [Mg2+] = [OH¯]/2
From that we can find out pOH= - log[OH-]
And at last pH = 14 - pOH
​So in this way we can find out pH when solubility product of the solution is known.
Regards