The determinant of the given \(2 \times 2\) matrix \[ \begin{vmatrix} x+1 & x-1 \\ x^2+x+1 & x^2-x+1 \end{vmatrix} \] is calculated as follows: The determinant is the product of the main diagonal elements minus the product of the anti-diagonal elements. The product of the main diagonal is \( (x+1)(x^2-x+1) \). Expanding this gives \( x^3 - x^2 + x + x^2 - x + 1 = x^3 + x + 1 \). The product of the anti-diagonal is \( (x-1)(x^2+x+1) \). Expanding this gives \( x^3 + x^2 + x - x^2 - x - 1 = x^3 - 1 \). Subtracting the anti-diagonal product from the main diagonal product: \( (x^3 + x + 1) - (x^3 - 1) = x^3 + x + 1 - x^3 + 1 = 2 \). Therefore, the value of the determinant is \(2\).