prove that the following function is differentiable at x=0 using first principles:

f(x)= e^x when x<0
x=1 when x>0 or x=0

also is f(x) differntiable for all real x?

To prove that the function f(x) = e^x for x < 0, f(x) = x for x > 0 or x = 0 is differentiable at x = 0 using first principles, we need to show that the limit of the difference quotient exists as x approaches 0.

First, let's find the derivative of f(x) = e^x for x < 0. The derivative of e^x is simply e^x.

Now, let's find the derivative of f(x) = x for x > 0 or x = 0. The derivative of x with respect to x is 1.

To prove differentiability at x = 0, we need to show that the following limit exists:

lim [f(x) - f(0)] / (x - 0)
x->0

Since x = 0 is our point of interest, we can substitute it into the difference quotient:

lim [f(x) - f(0)] / x
x->0

Let's compute the limit separately for x < 0 and x > 0:

For x < 0:
lim [e^x - e^0] / x
x->0-

Since e^0 is equal to 1, the expression simplifies to:

lim [e^x - 1] / x
x->0-

To proceed, we apply L'Hôpital's Rule by finding the derivative of the numerator and denominator:

lim [d/dx(e^x - 1)] / (d/dx(x))
x->0-

The derivative of e^x is e^x, and the derivative of x is 1, so the expression becomes:

lim [e^x] / 1
x->0-

Evaluating the limit as x approaches 0- gives:

lim (e^0) / 1
x->0-

Since e^0 is equal to 1, the limit becomes:

lim 1 / 1
x->0-
= 1

For x > 0:
lim [x - f(0)] / x
x->0+

Substituting f(0) = 1, the expression becomes:

lim [x - 1] / x
x->0+

Again, applying L'Hôpital's Rule by finding the derivative of the numerator and denominator:

lim [d/dx(x - 1)] / (d/dx(x))
x->0+

The derivative of x is 1, and the derivative of 1 is 0, so the expression becomes:

lim 1 / 1
x->0+
= 1

Since the limits from both sides of 0 are equal (lim x->0- = 1 and lim x->0+ = 1), the limit of the difference quotient as x approaches 0 exists. Hence, the function f(x) = e^x for x < 0, f(x) = x for x > 0 or x = 0 is differentiable at x = 0.

Regarding the differentiability of f(x) for all real x, f(x) is not differentiable at x = 0 because the left and right derivatives at this point are different (as shown in the above calculations). However, f(x) is differentiable for all other real x, both positive and negative, since the derivative exists for each part of the piecewise function.