Since \(p(x)\) is divisible by \((2x - 1)\), we have \(p\left(\frac{1}{2}\right) = 0\).
Substitute \(x = \frac{1}{2}\) into \(p(x)\):
\(a\left(\frac{1}{2}\right)^3 + \left(\frac{1}{2}\right)^2 + b\left(\frac{1}{2}\right) + 3 = 0\)
\(\frac{1}{8}a + \frac{1}{4} + \frac{1}{2}b + 3 = 0\)
Multiply through by 8 to clear fractions:
\(a + 2 + 4b + 24 = 0\)
\(a + 4b = -26\)
When \(p(x)\) is divided by \((x + 2)\), the remainder is 5, so \(p(-2) = 5\).
Substitute \(x = -2\) into \(p(x)\):
\(a(-2)^3 + (-2)^2 + b(-2) + 3 = 5\)
\(-8a + 4 - 2b + 3 = 5\)
\(-8a - 2b = -2\)
\(8a + 2b = 2\)
Now solve the system of equations:
1. \(a + 4b = -26\)
2. \(8a + 2b = 2\)
Multiply equation 1 by 2:
\(2a + 8b = -52\)
Subtract equation 2 from this result:
\(2a + 8b - 8a - 2b = -52 - 2\)
\(-6a + 6b = -54\)
\(-a + b = -9\)
\(b = a - 9\)
Substitute \(b = a - 9\) into equation 1:
\(a + 4(a - 9) = -26\)
\(a + 4a - 36 = -26\)
\(5a = 10\)
\(a = 2\)
Substitute \(a = 2\) back to find \(b\):
\(b = 2 - 9 = -7\)
Thus, \(a = 2\) and \(b = -7\).