# Finding all values of a and b which make this piecewise function continuous

Find all values of a and b that make this piecewise function continuous.

$$f(x)=\begin{cases} (x - π)^2-1&\text{if }x < π\\ b &\text{if } x= π\\ 2\cos(x)+a &\text{if } x > π\end{cases}$$

I tried making the first two expressions equal to one another and then finally the second expression equal to the last expression. I substituted $$π$$ into x for all expressions to find a and b.

Is this the right approach? If not please correct me as I don't understand the ins and outs of piecewise functions that well yet.

First pair of expressions:

$$(π - π)^2-1 = b$$

$$b = -1$$

Second pair of expressions:

$$b =2\cos(π)+a$$

$$-1 = 2\cos(π)+a$$

$$-1 = -2 +a$$

$$a = 1$$

The values of a and b that make $$f(x)$$ continuous are $$a = 1$$ and $$b=-1$$.

• Looks good to me! – Matti P. Aug 12 at 6:43

We have $$\lim_{x \to \pi -0}f(x)=-1, f(\pi)=b$$ and $$\lim_{x \to \pi +0}f(x)=-2+a.$$
Hence $$f$$ is continuous on $$\mathbb R \iff f$$ is continuous in $$\pi \iff -1=b=-2+a.$$