To get the adjacent, we use the Pythagoras’ theorem which states that the square of the hypotenuse is equal the sum of the squares of the two other sides
Let the adjacent be x
4^2 = 3^2 + x^2
x^2 = 16-9
x^2 = 7
x = √7
The cosine is the ratio of the adjacent to the hypotenuse