Given the function $$f(x)\begin{cases} -2(x+1), & \text{x $\le0$} \\ k(1-x^2), & \text{x $\gt0$} \\ \end{cases}$$
Find the value of k for $$\int_{-1}^1f(x)dx=1$$
Wasn't really sure how to do this but this is what I did:
Integrate first function from -1 to 0:
$$\int_{-1}^0-2(x+1)=-1$$
Second Integral:
$$\int_0^1k(1-x^2) = 2$$ $$= \left[kx-\frac{kx^3}{3}\right]_0^1=2$$ $$k-\frac{k}{3}=2$$ $$\frac{2}{3}k=2$$ $$k=3$$
So therefore k must be 3 for $\int_{-1}^1f(x)dx=1$
Is this correct?
The first integral is incorrect:
$$\int_{-1}^0-2(x+1)$$
$$\left[-x^2 - 2x\right]_{-1}^0$$
$$0-(-1+2) = -1$$
EDIT
The OP made an error within the question. His work and answer are both correct now.