its by basic definition of cot(theta).
the figure shows an obtuse angle. but you can redraw with theta as acute angle to visualize better. write down the lengths of base and height i.e. x and y.
You can find cos and sin of the angle and find cot by relation cot=cos/sin.
(of the angle theta).