The function f(x)=x^2-ax if x is less than or equal to 1

and f(x)=ax+b if x is greater than 1 where a and b are constants. If f is differentiable at x=1 then a+b=

A.-3
B.-2
C.0
D.2

To determine the value of a+b, we need to apply the differentiability condition at x=1.

In order for a function to be differentiable at a point, the left-hand derivative (the derivative before the point) and the right-hand derivative (the derivative after the point) must exist and be equal.

Let's start with the left-hand side of x=1. According to the given function, when x ≤ 1, f(x) = x^2 - ax.
To find the derivative, we differentiate f(x) with respect to x: f'(x) = 2x - a.

Now, let's consider the right-hand side of x=1. According to the given function, when x > 1, f(x) = ax + b.
To find the derivative, we differentiate f(x) with respect to x: f'(x) = a.

Since f is differentiable at x=1, the left-hand derivative and the right-hand derivative should be equal at x=1.
Setting the left-hand derivative equal to the right-hand derivative, we get:

2(1) - a = a

Simplifying the equation yields:
2 - a = a

Adding 'a' to both sides:
2 = 2a

Dividing both sides by 2:
a = 1

Now, substituting a = 1 back into either equation, we can solve for b. Let's use the equation f(x) = ax + b:

f(1) = a(1) + b

Substituting x = 1, a = 1, and f(1) = (1)^2 - a(1), we get:

1 = 1 + b

Subtracting 1 from both sides:
b = 0

Therefore, a + b = 1 + 0 = 1.

Hence, the correct answer is C. 0.