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