The cotangent function is defined as the ratio of the adjacent side to the opposite side in a right-angled triangle.