cot(x+y)=cos(x+y)/sin(x+y)=(cosxcosy-sinxsiny)/(sinxcosy+cosxsiny).
There are variations of this: divide top and bottom by cosx: (cosy-tanxsiny)/(tanxcosy+siny),
then by cosy: (1-tanxtany)/(tanx+tany). Dividing by sinx and siny instead gives:
(cotxcosy-siny)/(cosy+cotxsiny), then: (cotxcoty-1)/(coty+cotx).
(Using these variations and putting y=x, you can work out cot(2x).)
cos(2x)=cos^2(x)-sin^2(x), putting y=x.
This can also be written: 1-2sin^2(x) or 2cos^2(x)-1 because sin^2(x)+cos^2(x).