If the following function is continuous, what is the value of a + b?

f(x) = {3x^2 - 2x +1, if x < 0
a cos(x) + b, if 0 </= x </= pi/3
4sin^2(x), if x > pi/3

A. 0
B. 1
C. 2
D. 3
E. 4

I know that since the function is continuous, it should be equal to 1 at 0 and 3 at pi/3 (To follow the other two pieces of the function). From here, I am having a great deal of difficulty figuring out what coordinates would make the function work in this way. Any help is appreciated.

At x=0, a*cos(0)+b = 1 = 3x^2-2x+1

=> a+b= 1 = 3(0)-2(0)+1

At x=π/3,
a*cos(π/3) + b = 1 = 4sin^2(π/3)
=> (a/2) + b = 3/2 = 2*3/4

But you don't need to solve for a and b if only a+b is required. (see second line).

To determine the values of a and b, we can use the fact that the function is continuous at x = 0 and x = pi/3.

For the function to be continuous at x = 0, we need the left-hand limit and the right-hand limit to be equal. So we have:

Left-hand limit (as x approaches 0) = 3(0)^2 - 2(0) + 1 = 1
Right-hand limit (as x approaches 0) = a cos(0) + b = a + b

Therefore, a + b = 1. This gives us our first equation.

For the function to be continuous at x = pi/3, we again need the left-hand limit and the right-hand limit to be equal. So we have:

Left-hand limit (as x approaches pi/3) = a cos(pi/3) + b = (1/2)a + b
Right-hand limit (as x approaches pi/3) = 4sin^2(pi/3) = 4(3/4) = 3

Therefore, (1/2)a + b = 3. This gives us our second equation.

Now we have a system of equations to solve:

a + b = 1
(1/2)a + b = 3

To solve this system, we can multiply the first equation by 2 to eliminate the "a" variable:

2a + 2b = 2
(1/2)a + b = 3

Adding these equations yields:

(2a + 1/2a) + (2b + b) = 2 + 3
(4a + a) + 3b = 5
5a + 3b = 5

Now we have one equation in terms of "a" and "b". We can solve for "a" in terms of "b":

5a = 5 - 3b
a = (5 - 3b)/5

Substituting this into the first equation:

(5 - 3b)/5 + b = 1
5 - 3b + 5b = 5
2b = 0
b = 0

Substituting b = 0 into the equation for a:

a = (5 - 3(0))/5 = 5/5 = 1

Therefore, the values of a and b are a = 1 and b = 0.

To find the value of a + b, we simply add them together:

a + b = 1 + 0 = 1

So, the value of a + b is 1. Therefore, the correct answer is B.