4. The three sides of a triangle can be expressed as $m^{2}+m+1, 2m+1, m^{2}-1$, then the largest angle of this triangle is . $\qquad$
Solution: $\frac{2 \pi}{3}$
From the fact that all three sides are positive, we know that $m^{2}-1>0$, i.e., $m>1$. $m^{2}+m+1$ is the longest side, so let the angle opposite to it be $\alpha$. Then,
$$
\cos \alpha=\frac{\left(m^{2}-1\right)^{2}+(2 m+1)^{2}-\left(m^{2}+m+1\right)^{2}}{2\left(m^{2}-1\right)(2 m+1)}=-\frac{1}{2}
$$

Thus, $\alpha=\frac{2 \pi}{3}$