By definition the derivative of a function #f(x)# is:
#(df)/dx = lim_(h->0) (f(x+h)-f(x))/h#
Substituting: #f(x) = x^2-tanx#:
#(df)/dx = lim_(h->0) ((x+h)^2-x^2 -tan(x+h)+tanx)/h #
If the limits exist separately we have:
#(df)/dx = lim_(h->0) ((x+h)^2-x^2)/h -lim_(h->0)(tan(x+h)-tanx)/h #
So let's evaluate separately:
#lim_(h->0) ((x+h)^2-x^2)/h = lim_(h->0) (cancel(x^2)+2hx+h^2-cancel(x^2))/h#
#lim_(h->0) ((x+h)^2-x^2)/h = lim_(h->0) cancelh(2x+h)/cancelh#
#lim_(h->0) ((x+h)^2-x^2)/h = 2x#
and using the identity:
#tan(a+b) = (tana + tanb)/(1-tanatanb)#
#lim_(h->0) (tan(x+h)-tanx)/h = lim_(h->0) 1/h((tanx+tanh)/(1-tanxtanh)-tanx)#
#lim_(h->0) (tan(x+h)-tanx)/h = lim_(h->0) 1/h((canceltanx+tanh-canceltanx+tan^2xtanh)/(1-tanxtanh))#
#lim_(h->0) (tan(x+h)-tanx)/h = lim_(h->0) tanh/h((1+tan^2x)/(1-tanxtanh))#
#lim_(h->0) (tan(x+h)-tanx)/h = lim_(h->0) (sinh/h)(1/cosh)((1+tan^2x)/(1-tanxtanh))#
#lim_(h->0) (tan(x+h)-tanx)/h = 1*1*((1+tan^2x)/(1-tanx*0)) =1+tan^2x#
As:
#1+tan^2x = 1+sin^2x/cos^2x = (cos^2x+sin^2x)/cos^2x = 1/cos^2x#
putting it together we have:
#d/dx(x^2-tanx) = 2x-1/cos^2x#