# mathlibdocumentation

geometry.euclidean.basic

# Euclidean spaces #

This file makes some definitions and proves very basic geometrical results about real inner product spaces and Euclidean affine spaces. Results about real inner product spaces that involve the norm and inner product but not angles generally go in analysis.normed_space.inner_product. Results with longer proofs or more geometrical content generally go in separate files.

## Main definitions #

• inner_product_geometry.angle is the undirected angle between two vectors.

• euclidean_geometry.angle, with notation ∠, is the undirected angle determined by three points.

• euclidean_geometry.orthogonal_projection is the orthogonal projection of a point onto an affine subspace.

• euclidean_geometry.reflection is the reflection of a point in an affine subspace.

## Implementation notes #

To declare P as the type of points in a Euclidean affine space with V as the type of vectors, use [inner_product_space ℝ V] [metric_space P] [normed_add_torsor V P]. This works better with out_param to make V implicit in most cases than having a separate type alias for Euclidean affine spaces.

Rather than requiring Euclidean affine spaces to be finite-dimensional (as in the definition on Wikipedia), this is specified only for those theorems that need it.

## References #

### Geometrical results on real inner product spaces #

This section develops some geometrical definitions and results on 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.

noncomputable def inner_product_geometry.angle {V : Type u_1} (x y : V) :

The undirected angle between two vectors. If either vector is 0, this is π/2. See orientation.oangle for the corresponding oriented angle definition.

Equations
theorem inner_product_geometry.continuous_at_angle {V : Type u_1} {x : V × V} (hx1 : x.fst 0) (hx2 : x.snd 0) :
continuous_at (λ (y : V × V), x
theorem inner_product_geometry.angle_smul_smul {V : Type u_1} {c : } (hc : c 0) (x y : V) :
(c y) =
@[simp]
theorem linear_isometry.angle_map {E : Type u_1} {F : Type u_2} (f : E →ₗᵢ[] F) (u v : E) :
(f v) =
theorem inner_product_geometry.is_conformal_map.preserves_angle {E : Type u_1} {F : Type u_2} {f' : E →L[] F} (h : is_conformal_map f') (u v : E) :
(f' v) =
theorem inner_product_geometry.conformal_at.preserves_angle {E : Type u_1} {F : Type u_2} {f : E → F} {x : E} {f' : E →L[] F} (h : f' x) (H : x) (u v : E) :
(f' v) =

If a real differentiable map f is conformal at a point x, then it preserves the angles at that point.

theorem inner_product_geometry.cos_angle {V : Type u_1} (x y : V) :

The cosine of the angle between two vectors.

theorem inner_product_geometry.angle_comm {V : Type u_1} (x y : V) :

The angle between two vectors does not depend on their order.

@[simp]
theorem inner_product_geometry.angle_neg_neg {V : Type u_1} (x y : V) :

The angle between the negation of two vectors.

theorem inner_product_geometry.angle_nonneg {V : Type u_1} (x y : V) :

The angle between two vectors is nonnegative.

theorem inner_product_geometry.angle_le_pi {V : Type u_1} (x y : V) :

The angle between two vectors is at most π.

theorem inner_product_geometry.angle_neg_right {V : Type u_1} (x y : V) :

The angle between a vector and the negation of another vector.

theorem inner_product_geometry.angle_neg_left {V : Type u_1} (x y : V) :

The angle between the negation of a vector and another vector.

@[simp]
theorem inner_product_geometry.angle_zero_left {V : Type u_1} (x : V) :

The angle between the zero vector and a vector.

@[simp]
theorem inner_product_geometry.angle_zero_right {V : Type u_1} (x : V) :

The angle between a vector and the zero vector.

@[simp]
theorem inner_product_geometry.angle_self {V : Type u_1} {x : V} (hx : x 0) :

The angle between a nonzero vector and itself.

@[simp]
theorem inner_product_geometry.angle_self_neg_of_nonzero {V : Type u_1} {x : V} (hx : x 0) :

The angle between a nonzero vector and its negation.

@[simp]
theorem inner_product_geometry.angle_neg_self_of_nonzero {V : Type u_1} {x : V} (hx : x 0) :

The angle between the negation of a nonzero vector and that vector.

@[simp]
theorem inner_product_geometry.angle_smul_right_of_pos {V : Type u_1} (x y : V) {r : } (hr : 0 < r) :

The angle between a vector and a positive multiple of a vector.

@[simp]
theorem inner_product_geometry.angle_smul_left_of_pos {V : Type u_1} (x y : V) {r : } (hr : 0 < r) :

The angle between a positive multiple of a vector and a vector.

@[simp]
theorem inner_product_geometry.angle_smul_right_of_neg {V : Type u_1} (x y : V) {r : } (hr : r < 0) :
(r y) =

The angle between a vector and a negative multiple of a vector.

@[simp]
theorem inner_product_geometry.angle_smul_left_of_neg {V : Type u_1} (x y : V) {r : } (hr : r < 0) :
y =

The angle between a negative multiple of a vector and a vector.

theorem inner_product_geometry.cos_angle_mul_norm_mul_norm {V : Type u_1} (x y : V) :
* (x * y) =

The cosine of the angle between two vectors, multiplied by the product of their norms.

theorem inner_product_geometry.sin_angle_mul_norm_mul_norm {V : Type u_1} (x y : V) :
* (x * y) = real.sqrt x * - * y)

The sine of the angle between two vectors, multiplied by the product of their norms.

theorem inner_product_geometry.angle_eq_zero_iff {V : Type u_1} {x y : V} :
x 0 ∃ (r : ), 0 < r y = r x

The angle between two vectors is zero if and only if they are nonzero and one is a positive multiple of the other.

theorem inner_product_geometry.angle_eq_pi_iff {V : Type u_1} {x y : V} :
x 0 ∃ (r : ), r < 0 y = r x

The angle between two vectors is π if and only if they are nonzero and one is a negative multiple of the other.

theorem inner_product_geometry.angle_add_angle_eq_pi_of_angle_eq_pi {V : Type u_1} {x y : V} (z : V) (h : = real.pi) :

If the angle between two vectors is π, the angles between those vectors and a third vector add to π.

Two vectors have inner product 0 if and only if the angle between them is π/2.

If the angle between two vectors is π, the inner product equals the negative product of the norms.

theorem inner_product_geometry.inner_eq_mul_norm_of_angle_eq_zero {V : Type u_1} {x y : V} (h : = 0) :

If the angle between two vectors is 0, the inner product equals the product of the norms.

theorem inner_product_geometry.inner_eq_neg_mul_norm_iff_angle_eq_pi {V : Type u_1} {x y : V} (hx : x 0) (hy : y 0) :

The inner product of two non-zero vectors equals the negative product of their norms if and only if the angle between the two vectors is π.

theorem inner_product_geometry.inner_eq_mul_norm_iff_angle_eq_zero {V : Type u_1} {x y : V} (hx : x 0) (hy : y 0) :

The inner product of two non-zero vectors equals the product of their norms if and only if the angle between the two vectors is 0.

If the angle between two vectors is π, the norm of their difference equals the sum of their norms.

theorem inner_product_geometry.norm_add_eq_add_norm_of_angle_eq_zero {V : Type u_1} {x y : V} (h : = 0) :

If the angle between two vectors is 0, the norm of their sum equals the sum of their norms.

If the angle between two vectors is 0, the norm of their difference equals the absolute value of the difference of their norms.

theorem inner_product_geometry.norm_sub_eq_add_norm_iff_angle_eq_pi {V : Type u_1} {x y : V} (hx : x 0) (hy : y 0) :

The norm of the difference of two non-zero vectors equals the sum of their norms if and only the angle between the two vectors is π.

theorem inner_product_geometry.norm_add_eq_add_norm_iff_angle_eq_zero {V : Type u_1} {x y : V} (hx : x 0) (hy : y 0) :

The norm of the sum of two non-zero vectors equals the sum of their norms if and only the angle between the two vectors is 0.

theorem inner_product_geometry.norm_sub_eq_abs_sub_norm_iff_angle_eq_zero {V : Type u_1} {x y : V} (hx : x 0) (hy : y 0) :

The norm of the difference of two non-zero vectors equals the absolute value of the difference of their norms if and only the angle between the two vectors is 0.

The norm of the sum of two vectors equals the norm of their difference if and only if the angle between them is π/2.

### Geometrical results on Euclidean affine spaces #

This section develops some geometrical definitions and results on Euclidean affine spaces.

noncomputable def euclidean_geometry.angle {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (p1 p2 p3 : P) :

The undirected angle at p2 between the line segments to p1 and p3. If either of those points equals p2, this is π/2. Use open_locale euclidean_geometry to access the ∠ p1 p2 p3 notation.

Equations
theorem euclidean_geometry.continuous_at_angle {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {x : P × P × P} (hx12 : x.fst x.snd.fst) (hx32 : x.snd.snd x.snd.fst) :
continuous_at (λ (y : P × P × P), y.snd.snd) x
theorem euclidean_geometry.angle_comm {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (p1 p2 p3 : P) :
p3 = p1

The angle at a point does not depend on the order of the other two points.

theorem euclidean_geometry.angle_nonneg {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (p1 p2 p3 : P) :
0 p3

The angle at a point is nonnegative.

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

The angle at a point is at most π.

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

The angle ∠AAB at a point.

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

The angle ∠ABB at a point.

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

The angle ∠ABA at a point.

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

If the angle ∠ABC at a point is π, the angle ∠BAC is 0.

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

If the angle ∠ABC at a point is π, the angle ∠BCA is 0.

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

If ∠BCD = π, then ∠ABC = ∠ABD.

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

If ∠BCD = π, then ∠ACB + ∠ACD = π.

theorem euclidean_geometry.angle_eq_angle_of_angle_eq_pi_of_angle_eq_pi {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {p1 p2 p3 p4 p5 : P} (hapc : p3 = real.pi) (hbpd : p4 = real.pi) :
p2 = p4

Vertical Angles Theorem: angles opposite each other, formed by two intersecting straight lines, are equal.

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

If ∠ABC = π then dist A B ≠ 0.

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

If ∠ABC = π then dist C B ≠ 0.

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

If ∠ABC = π, then (dist A C) = (dist A B) + (dist B C).

theorem euclidean_geometry.dist_eq_add_dist_iff_angle_eq_pi {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {p1 p2 p3 : P} (hp1p2 : p1 p2) (hp3p2 : p3 p2) :
p3 = p2 + p2 p3 = real.pi

If A ≠ B and C ≠ B then ∠ABC = π if and only if (dist A C) = (dist A B) + (dist B C).

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

If ∠ABC = 0, then (dist A C) = abs ((dist A B) - (dist B C)).

theorem euclidean_geometry.dist_eq_abs_sub_dist_iff_angle_eq_zero {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {p1 p2 p3 : P} (hp1p2 : p1 p2) (hp3p2 : p3 p2) :
p3 = | p2 - p2| p3 = 0

If A ≠ B and C ≠ B then ∠ABC = 0 if and only if (dist A C) = abs ((dist A B) - (dist B C)).

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

The midpoint of the segment AB is the same distance from A as it is from B.

theorem euclidean_geometry.angle_midpoint_eq_pi {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (p1 p2 : P) (hp1p2 : p1 p2) :
p1 p2) p2 = real.pi

If M is the midpoint of the segment AB, then ∠AMB = π.

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

If M is the midpoint of the segment AB and C is the same distance from A as it is from B then ∠CMA = π / 2.

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

If M is the midpoint of the segment AB and C is the same distance from A as it is from B then ∠CMB = π / 2.

theorem euclidean_geometry.inner_weighted_vsub {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {ι₁ : Type u_3} {s₁ : finset ι₁} {w₁ : ι₁ → } (p₁ : ι₁ → P) (h₁ : s₁.sum (λ (i : ι₁), w₁ i) = 0) {ι₂ : Type u_4} {s₂ : finset ι₂} {w₂ : ι₂ → } (p₂ : ι₂ → P) (h₂ : s₂.sum (λ (i : ι₂), w₂ i) = 0) :
has_inner.inner ((s₁.weighted_vsub p₁) w₁) ((s₂.weighted_vsub p₂) w₂) = -s₁.sum (λ (i₁ : ι₁), s₂.sum (λ (i₂ : ι₂), w₁ i₁ * w₂ i₂ * (has_dist.dist (p₁ i₁) (p₂ i₂) * has_dist.dist (p₁ i₁) (p₂ i₂)))) / 2

The inner product of two vectors given with weighted_vsub, in terms of the pairwise distances.

theorem euclidean_geometry.dist_affine_combination {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {ι : Type u_3} {s : finset ι} {w₁ w₂ : ι → } (p : ι → P) (h₁ : s.sum (λ (i : ι), w₁ i) = 1) (h₂ : s.sum (λ (i : ι), w₂ i) = 1) :
has_dist.dist ((s.affine_combination p) w₁) ((s.affine_combination p) w₂) * has_dist.dist ((s.affine_combination p) w₁) ((s.affine_combination p) w₂) = -s.sum (λ (i₁ : ι), s.sum (λ (i₂ : ι), (w₁ - w₂) i₁ * (w₁ - w₂) i₂ * (has_dist.dist (p i₁) (p i₂) * has_dist.dist (p i₁) (p i₂)))) / 2

The distance between two points given with affine_combination, in terms of the pairwise distances between the points in that combination.

theorem euclidean_geometry.inner_vsub_vsub_of_dist_eq_of_dist_eq {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {c₁ c₂ p₁ p₂ : P} (hc₁ : c₁ = c₁) (hc₂ : c₂ = c₂) :
has_inner.inner (c₂ -ᵥ c₁) (p₂ -ᵥ p₁) = 0

Suppose that c₁ is equidistant from p₁ and p₂, and the same applies to c₂. Then the vector between c₁ and c₂ is orthogonal to that between p₁ and p₂. (In two dimensions, this says that the diagonals of a kite are orthogonal.)

theorem euclidean_geometry.dist_smul_vadd_sq {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (r : ) (v : V) (p₁ p₂ : P) :
has_dist.dist (r v +ᵥ p₁) p₂ * has_dist.dist (r v +ᵥ p₁) p₂ = * r * r + 2 * (p₁ -ᵥ p₂) * r + has_inner.inner (p₁ -ᵥ p₂) (p₁ -ᵥ p₂)

The squared distance between points on a line (expressed as a multiple of a fixed vector added to a point) and another point, expressed as a quadratic.

theorem euclidean_geometry.dist_smul_vadd_eq_dist {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {v : V} (p₁ p₂ : P) (hv : v 0) (r : ) :
has_dist.dist (r v +ᵥ p₁) p₂ = p₂ r = 0 r = (-2) * (p₁ -ᵥ p₂) /

The condition for two points on a line to be equidistant from another point.

theorem euclidean_geometry.eq_of_dist_eq_of_dist_eq_of_mem_of_finrank_eq_two {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} (hd : = 2) {c₁ c₂ p₁ p₂ p : P} (hc₁s : c₁ s) (hc₂s : c₂ s) (hp₁s : p₁ s) (hp₂s : p₂ s) (hps : p s) {r₁ r₂ : } (hc : c₁ c₂) (hp : p₁ p₂) (hp₁c₁ : c₁ = r₁) (hp₂c₁ : c₁ = r₁) (hpc₁ : c₁ = r₁) (hp₁c₂ : c₂ = r₂) (hp₂c₂ : c₂ = r₂) (hpc₂ : c₂ = r₂) :
p = p₁ p = p₂

Distances r₁ r₂ of p from two different points c₁ c₂ determine at most two points p₁ p₂ in a two-dimensional subspace containing those points (two circles intersect in at most two points).

theorem euclidean_geometry.eq_of_dist_eq_of_dist_eq_of_finrank_eq_two {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (hd : = 2) {c₁ c₂ p₁ p₂ p : P} {r₁ r₂ : } (hc : c₁ c₂) (hp : p₁ p₂) (hp₁c₁ : c₁ = r₁) (hp₂c₁ : c₁ = r₁) (hpc₁ : c₁ = r₁) (hp₁c₂ : c₂ = r₂) (hp₂c₂ : c₂ = r₂) (hpc₂ : c₂ = r₂) :
p = p₁ p = p₂

Distances r₁ r₂ of p from two different points c₁ c₂ determine at most two points p₁ p₂ in two-dimensional space (two circles intersect in at most two points).

noncomputable def euclidean_geometry.orthogonal_projection_fn {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (s : P) [nonempty s] [complete_space (s.direction)] (p : P) :
P

The orthogonal projection of a point onto a nonempty affine subspace, whose direction is complete, as an unbundled function. This definition is only intended for use in setting up the bundled version orthogonal_projection and should not be used once that is defined.

Equations
theorem euclidean_geometry.inter_eq_singleton_orthogonal_projection_fn {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] (p : P) :

The intersection of the subspace and the orthogonal subspace through the given point is the orthogonal_projection_fn of that point onto the subspace. This lemma is only intended for use in setting up the bundled version and should not be used once that is defined.

theorem euclidean_geometry.orthogonal_projection_fn_mem {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] (p : P) :

The orthogonal_projection_fn lies in the given subspace. This lemma is only intended for use in setting up the bundled version and should not be used once that is defined.

theorem euclidean_geometry.orthogonal_projection_fn_mem_orthogonal {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] (p : P) :

The orthogonal_projection_fn lies in the orthogonal subspace. This lemma is only intended for use in setting up the bundled version and should not be used once that is defined.

theorem euclidean_geometry.orthogonal_projection_fn_vsub_mem_direction_orthogonal {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] (p : P) :

Subtracting p from its orthogonal_projection_fn produces a result in the orthogonal direction. This lemma is only intended for use in setting up the bundled version and should not be used once that is defined.

noncomputable def euclidean_geometry.orthogonal_projection {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (s : P) [nonempty s] [complete_space (s.direction)] :

The orthogonal projection of a point onto a nonempty affine subspace, whose direction is complete. The corresponding linear map (mapping a vector to the difference between the projections of two points whose difference is that vector) is the orthogonal_projection for real inner product spaces, onto the direction of the affine subspace being projected onto.

Equations
@[simp]
theorem euclidean_geometry.orthogonal_projection_fn_eq {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] (p : P) :
@[simp]
theorem euclidean_geometry.orthogonal_projection_linear {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] :

The linear map corresponding to orthogonal_projection.

theorem euclidean_geometry.inter_eq_singleton_orthogonal_projection {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] (p : P) :

The intersection of the subspace and the orthogonal subspace through the given point is the orthogonal_projection of that point onto the subspace.

theorem euclidean_geometry.orthogonal_projection_mem {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] (p : P) :

The orthogonal_projection lies in the given subspace.

theorem euclidean_geometry.orthogonal_projection_mem_orthogonal {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (s : P) [nonempty s] [complete_space (s.direction)] (p : P) :

The orthogonal_projection lies in the orthogonal subspace.

theorem euclidean_geometry.orthogonal_projection_vsub_mem_direction {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] {p1 : P} (p2 : P) (hp1 : p1 s) :
-ᵥ p1, hp1⟩) s.direction

Subtracting a point in the given subspace from the orthogonal_projection produces a result in the direction of the given subspace.

theorem euclidean_geometry.vsub_orthogonal_projection_mem_direction {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] {p1 : P} (p2 : P) (hp1 : p1 s) :
(p1, hp1⟩ -ᵥ s.direction

Subtracting the orthogonal_projection from a point in the given subspace produces a result in the direction of the given subspace.

theorem euclidean_geometry.orthogonal_projection_eq_self_iff {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] {p : P} :
p s

A point equals its orthogonal projection if and only if it lies in the subspace.

@[simp]
theorem euclidean_geometry.orthogonal_projection_mem_subspace_eq_self {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] (p : s) :
@[simp]
theorem euclidean_geometry.orthogonal_projection_orthogonal_projection {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (s : P) [nonempty s] [complete_space (s.direction)] (p : P) :

Orthogonal projection is idempotent.

theorem euclidean_geometry.eq_orthogonal_projection_of_eq_subspace {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s s' : P} [nonempty s] [nonempty s'] [complete_space (s.direction)] [complete_space (s'.direction)] (h : s = s') (p : P) :
theorem euclidean_geometry.dist_orthogonal_projection_eq_zero_iff {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] {p : P} :
p s

The distance to a point's orthogonal projection is 0 iff it lies in the subspace.

theorem euclidean_geometry.dist_orthogonal_projection_ne_zero_of_not_mem {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] {p : P} (hp : p s) :

The distance between a point and its orthogonal projection is nonzero if it does not lie in the subspace.

Subtracting p from its orthogonal_projection produces a result in the orthogonal direction.

Subtracting the orthogonal_projection from p produces a result in the orthogonal direction.

theorem euclidean_geometry.orthogonal_projection_vsub_orthogonal_projection {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (s : P) [nonempty s] [complete_space (s.direction)] (p : P) :
= 0

Subtracting the orthogonal_projection from p produces a result in the kernel of the linear part of the orthogonal projection.

theorem euclidean_geometry.orthogonal_projection_vadd_eq_self {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] {p : P} (hp : p s) {v : V} (hv : v (s.direction)) :
= p, hp⟩

Adding a vector to a point in the given subspace, then taking the orthogonal projection, produces the original point if the vector was in the orthogonal direction.

theorem euclidean_geometry.orthogonal_projection_vadd_smul_vsub_orthogonal_projection {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] {p1 : P} (p2 : P) (r : ) (hp : p1 s) :
(r (p2 -ᵥ +ᵥ p1) = p1, hp⟩

Adding a vector to a point in the given subspace, then taking the orthogonal projection, produces the original point if the vector is a multiple of the result of subtracting a point's orthogonal projection from that point.

theorem euclidean_geometry.dist_sq_eq_dist_orthogonal_projection_sq_add_dist_orthogonal_projection_sq {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] {p1 : P} (p2 : P) (hp1 : p1 s) :
p2 * p2 = +

The square of the distance from a point in s to p2 equals the sum of the squares of the distances of the two points to the orthogonal_projection.

theorem euclidean_geometry.dist_sq_smul_orthogonal_vadd_smul_orthogonal_vadd {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} {p1 p2 : P} (hp1 : p1 s) (hp2 : p2 s) (r1 r2 : ) {v : V} (hv : v (s.direction)) :
has_dist.dist (r1 v +ᵥ p1) (r2 v +ᵥ p2) * has_dist.dist (r1 v +ᵥ p1) (r2 v +ᵥ p2) = p2 * p2 + (r1 - r2) * (r1 - r2) * (v * v)

The square of the distance between two points constructed by adding multiples of the same orthogonal vector to points in the same subspace.

noncomputable def euclidean_geometry.reflection {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (s : P) [nonempty s] [complete_space (s.direction)] :

Reflection in an affine subspace, which is expected to be nonempty and complete. The word "reflection" is sometimes understood to mean specifically reflection in a codimension-one subspace, and sometimes more generally to cover operations such as reflection in a point. The definition here, of reflection in an affine subspace, is a more general sense of the word that includes both those common cases.

Equations
theorem euclidean_geometry.reflection_apply {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (s : P) [nonempty s] [complete_space (s.direction)] (p : P) :

The result of reflecting.

theorem euclidean_geometry.eq_reflection_of_eq_subspace {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s s' : P} [nonempty s] [nonempty s'] [complete_space (s.direction)] [complete_space (s'.direction)] (h : s = s') (p : P) :
@[simp]
theorem euclidean_geometry.reflection_reflection {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (s : P) [nonempty s] [complete_space (s.direction)] (p : P) :

Reflecting twice in the same subspace.

@[simp]
theorem euclidean_geometry.reflection_symm {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (s : P) [nonempty s] [complete_space (s.direction)] :

Reflection is its own inverse.

theorem euclidean_geometry.reflection_involutive {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (s : P) [nonempty s] [complete_space (s.direction)] :

Reflection is involutive.

theorem euclidean_geometry.reflection_eq_self_iff {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] (p : P) :
p s

A point is its own reflection if and only if it is in the subspace.

theorem euclidean_geometry.reflection_eq_iff_orthogonal_projection_eq {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (s₁ s₂ : P) [nonempty s₁] [nonempty s₂] [complete_space (s₁.direction)] [complete_space (s₂.direction)] (p : P) :

Reflecting a point in two subspaces produces the same result if and only if the point has the same orthogonal projection in each of those subspaces.

theorem euclidean_geometry.dist_reflection {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (s : P) [nonempty s] [complete_space (s.direction)] (p₁ p₂ : P) :
p₂) = p₂

The distance between p₁ and the reflection of p₂ equals that between the reflection of p₁ and p₂.

theorem euclidean_geometry.dist_reflection_eq_of_mem {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (s : P) [nonempty s] [complete_space (s.direction)] {p₁ : P} (hp₁ : p₁ s) (p₂ : P) :
p₂) = p₂

A point in the subspace is equidistant from another point and its reflection.

theorem euclidean_geometry.reflection_mem_of_le_of_mem {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s₁ s₂ : P} [nonempty s₁] [complete_space (s₁.direction)] (hle : s₁ s₂) {p : P} (hp : p s₂) :
s₂

The reflection of a point in a subspace is contained in any larger subspace containing both the point and the subspace reflected in.

theorem euclidean_geometry.reflection_orthogonal_vadd {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] {p : P} (hp : p s) {v : V} (hv : v (s.direction)) :
(v +ᵥ p) = -v +ᵥ p

Reflecting an orthogonal vector plus a point in the subspace produces the negation of that vector plus the point.

theorem euclidean_geometry.reflection_vadd_smul_vsub_orthogonal_projection {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : P} [nonempty s] [complete_space (s.direction)] {p₁ : P} (p₂ : P) (r : ) (hp₁ : p₁ s) :
(r (p₂ -ᵥ +ᵥ p₁) = -(r (p₂ -ᵥ +ᵥ p₁

Reflecting a vector plus a point in the subspace produces the negation of that vector plus the point if the vector is a multiple of the result of subtracting a point's orthogonal projection from that point.

def euclidean_geometry.cospherical {P : Type u_2} [metric_space P] (ps : set P) :
Prop

A set of points is cospherical if they are equidistant from some point. In two dimensions, this is the same thing as being concyclic.

Equations
• = ∃ (center : P) (radius : ), ∀ (p : P), p ps center = radius
theorem euclidean_geometry.cospherical_def {P : Type u_2} [metric_space P] (ps : set P) :
∃ (center : P) (radius : ), ∀ (p : P), p ps center = radius

The definition of cospherical.

theorem euclidean_geometry.cospherical_subset {P : Type u_2} [metric_space P] {ps₁ ps₂ : set P} (hs : ps₁ ps₂) (hc : euclidean_geometry.cospherical ps₂) :

A subset of a cospherical set is cospherical.

theorem euclidean_geometry.cospherical_empty {V : Type u_1} {P : Type u_2} [metric_space P] [ P] :

The empty set is cospherical.

theorem euclidean_geometry.cospherical_singleton {P : Type u_2} [metric_space P] (p : P) :

A single point is cospherical.

theorem euclidean_geometry.cospherical_pair {V : Type u_1} {P : Type u_2} [metric_space P] [ P] (p₁ p₂ : P) :

Two points are cospherical.

theorem euclidean_geometry.cospherical.affine_independent {V : Type u_1} {P : Type u_2} [metric_space P] [ P] {s : set P} {p : fin 3 → P} (hps : s) (hpi : function.injective p) :

Any three points in a cospherical set are affinely independent.