Trigonometry (Greek: "the measure of triangles") is a branch of mathematics dealing with angles, triangles and trigonometric functions such as sine and cosine. It has some relationship to geometry, though people don't seem to agree on exactly what that relationship is. For some, trigonometry is just a subtopic of geometry.

It has many applications: the technique of triangulation for instance is used in astronomy to measure the distance to nearby stars, in geography to measure distances between landmarks, and in satellite navigation systems.

Two triangles are said to be similar if one can be obtained by uniformly expanding the other. This is the case if and only if their corresponding angles are equal, and it occurs for example when two triangles share an angle and the sides opposite to that angle are parallel. The crucial fact about similar triangles is that the lengths of their sides are proportionate. That is, if the longest side of a triangle is twice that of the longest side of a similar triangle, say, then the shortest side will also be twice that of the shortest side of the other triangle, and the median side will be twice that of the other triangle. Also, the ratio of the longest side to the shortest in the first triangle will be the same as the ratio of the longest side to the shortest in the other triangle.

Using these facts, one defines trigonometric functions, starting with right triangles, triangles with one angle being a right one (90 degrees or π/2 radians). The longest side in such a triangle is the side opposite the right angle, it is called the hypotenuse.

Pick two right triangles which share a second angle A. These triangles are necessarily similar, and the ratio of the side opposite to A to the hypotenuse will therefore be the same for the two triangles. It will be a number between 0 and 1 which depends only on A; we call it the sine of A and write it as sin(A). Similarly, one can define the cosine of A as the ratio of the side adjacent to A to the hypotenuse.

These are by far the most important trigonometric functions; other functions can be defined by taking ratios of other sides of the right triangles but they can all be expressed in terms of sine and cosine. These are the tangent, secant, cotangent, and cosecant.

So far, the trigonometric functions have been defined for angles between 0 and 90 degrees (0 and π/2 radians) only. Using the unit circle, one may extend them to all positive and negative arguments. (See trigonometric function.) Once the sine and cosine functions have been tabulated (or computed by a calculator), one can answer virtually all questions about arbitrary triangles, using the law of sines and the law of cosines. These laws can be used to compute the remaining angles and sides of any triangle as soon as two sides and an angle or two angles and a side or three sides are known.

Some mathematicians believe that trigonometry was originally invented to calculate sundials, a traditional exercise in the oldest books. It is also much used in surveying.

See also trigonometric identity, triangulation.