# mathlib3documentation

geometry.euclidean.triangle

# Triangles #

THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.

This file proves basic geometrical results about distances and angles in (possibly degenerate) triangles in real inner product spaces and Euclidean affine spaces. More specialized results, and results developed for simplices in general rather than just for triangles, are in separate files. Definitions and results that make sense in more general affine spaces rather than just in the Euclidean case go under linear_algebra.affine_space.

## Implementation notes #

Results in this file are generally given in a form with only those non-degeneracy conditions needed for the particular result, rather than requiring affine independence of the points of a triangle unnecessarily.

## References #

### Geometrical results on triangles in real inner product spaces #

This section develops some results on (possibly degenerate) triangles in real inner product spaces, where those definitions and results can most conveniently be developed in terms of vectors and then used to deduce corresponding results for Euclidean affine spaces.

Law of cosines (cosine rule), vector angle form.

theorem inner_product_geometry.angle_sub_eq_angle_sub_rev_of_norm_eq {V : Type u_1} {x y : V} (h : x = y) :
(x - y) = (y - x)

Pons asinorum, vector angle form.

theorem inner_product_geometry.norm_eq_of_angle_sub_eq_angle_sub_rev_of_angle_ne_pi {V : Type u_1} {x y : V} (h : (x - y) = (y - x)) (hpi : real.pi) :

Converse of pons asinorum, vector angle form.

theorem inner_product_geometry.cos_angle_sub_add_angle_sub_rev_eq_neg_cos_angle {V : Type u_1} {x y : V} (hx : x 0) (hy : y 0) :
real.cos (x - y) + (y - x)) =

The cosine of the sum of two angles in a possibly degenerate triangle (where two given sides are nonzero), vector angle form.

theorem inner_product_geometry.sin_angle_sub_add_angle_sub_rev_eq_sin_angle {V : Type u_1} {x y : V} (hx : x 0) (hy : y 0) :
real.sin (x - y) + (y - x)) =

The sine of the sum of two angles in a possibly degenerate triangle (where two given sides are nonzero), vector angle form.

theorem inner_product_geometry.cos_angle_add_angle_sub_add_angle_sub_eq_neg_one {V : Type u_1} {x y : V} (hx : x 0) (hy : y 0) :
real.cos + (y - x)) = -1

The cosine of the sum of the angles of a possibly degenerate triangle (where two given sides are nonzero), vector angle form.

theorem inner_product_geometry.sin_angle_add_angle_sub_add_angle_sub_eq_zero {V : Type u_1} {x y : V} (hx : x 0) (hy : y 0) :
real.sin + (y - x)) = 0

The sine of the sum of the angles of a possibly degenerate triangle (where two given sides are nonzero), vector angle form.

theorem inner_product_geometry.angle_add_angle_sub_add_angle_sub_eq_pi {V : Type u_1} {x y : V} (hx : x 0) (hy : y 0) :
+ (y - x) = real.pi

The sum of the angles of a possibly degenerate triangle (where the two given sides are nonzero), vector angle form.

### Geometrical results on triangles in Euclidean affine spaces #

This section develops some geometrical definitions and results on (possible degenerate) triangles in Euclidean affine spaces.

theorem euclidean_geometry.dist_sq_eq_dist_sq_add_dist_sq_sub_two_mul_dist_mul_dist_mul_cos_angle {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (p1 p2 p3 : P) :
p3 * p3 = p2 * p2 + p2 * p2 - 2 * p2 * p2 * real.cos p2 p3)

Law of cosines (cosine rule), angle-at-point form.

theorem euclidean_geometry.law_cos {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (p1 p2 p3 : P) :
p3 * p3 = p2 * p2 + p2 * p2 - 2 * p2 * p2 * real.cos p2 p3)

Alias of euclidean_geometry.dist_sq_eq_dist_sq_add_dist_sq_sub_two_mul_dist_mul_dist_mul_cos_angle.

theorem euclidean_geometry.angle_eq_angle_of_dist_eq {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {p1 p2 p3 : P} (h : p2 = p3) :
p3 = p2

Isosceles Triangle Theorem: Pons asinorum, angle-at-point form.

theorem euclidean_geometry.dist_eq_of_angle_eq_angle_of_angle_ne_pi {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {p1 p2 p3 : P} (h : p3 = p2) (hpi : p3 real.pi) :
p2 = p3

Converse of pons asinorum, angle-at-point form.

theorem euclidean_geometry.angle_add_angle_add_angle_eq_pi {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {p1 p2 p3 : P} (h2 : p2 p1) (h3 : p3 p1) :
p3 + p1 + p2 = real.pi

The sum of the angles of a triangle (possibly degenerate, where the given vertex is distinct from the others), angle-at-point.

theorem euclidean_geometry.oangle_add_oangle_add_oangle_eq_pi {V : Type u_1} {P : Type u_2} [metric_space P] [ P] [ (fin 2)] [fact (fdim V = 2)] {p1 p2 p3 : P} (h21 : p2 p1) (h32 : p3 p2) (h13 : p1 p3) :
p3 + p1 + p2 = real.pi

The sum of the angles of a triangle (possibly degenerate, where the triangle is a line), oriented angles at point.

theorem euclidean_geometry.dist_sq_mul_dist_add_dist_sq_mul_dist {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (a b c p : P) (h : = real.pi) :
^ 2 * + ^ 2 * = * p ^ 2 + * p)

Stewart's Theorem.

theorem euclidean_geometry.dist_sq_add_dist_sq_eq_two_mul_dist_midpoint_sq_add_half_dist_sq {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (a b c : P) :
^ 2 + ^ 2 = 2 * b c) ^ 2 + c / 2) ^ 2)

Apollonius's Theorem.

theorem euclidean_geometry.dist_mul_of_eq_angle_of_dist_mul {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (a b c a' b' c' : P) (r : ) (h : c' = ) (hab : b' = r * ) (hcb : b' = r * ) :
c' = r *