Let f(x)=cos(x−π8)
Thus using first principle
f′(x)=limx→0f(x+h)−f(x)h
=limx→01h[cos(x+h−π8)−cos(x−π8)]
=limx→01h⎡⎢
⎢⎣−2sin(x+h−π8+x−π8)2sin(x+h−π8−x+π82)⎤⎥
⎥⎦
=limx→01h[−2sin(2x+h−π42)sinh2]
=limx→0⎡⎢
⎢⎣−sin(2x+h−π42)sin(h2)(h2)⎤⎥
⎥⎦
=−sin(2x+0−π42)⋅1=−sin(x−π8)