The cosine is correct, but it looks like you confused cotangent with cosecant. Remember that cotangent is adjacent over opposite.