Skip to content

Commit 167af5a

Browse files
urkudjoneugster
authored andcommitted
feat(Archive/Imo): formalize IMO 1961q3 (#9883)
Co-authored-by: Jon Eugster <eugster.jon@gmail.com>
1 parent f8905ed commit 167af5a

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

Archive.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Archive.Imo.Imo1959Q1
99
import Archive.Imo.Imo1959Q2
1010
import Archive.Imo.Imo1960Q1
1111
import Archive.Imo.Imo1960Q2
12+
import Archive.Imo.Imo1961Q3
1213
import Archive.Imo.Imo1962Q1
1314
import Archive.Imo.Imo1962Q4
1415
import Archive.Imo.Imo1964Q1

Archive/Imo/Imo1961Q3.lean

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/-
2+
Copyright (c) 2024 Yury Kudryashov. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Yury Kudryashov
5+
-/
6+
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Complex
7+
8+
/-!
9+
# IMO 1961 Q3
10+
11+
Solve the equation
12+
13+
$\cos^n x - \sin^n x = 1$,
14+
15+
where $n$ is a given positive integer.
16+
17+
The solution is based on the one at the
18+
[Art of Problem Solving](https://artofproblemsolving.com/wiki/index.php/1961_IMO_Problems/Problem_3)
19+
website.
20+
-/
21+
22+
open Real
23+
24+
theorem Imo1961Q3 {n : ℕ} {x : ℝ} (h₀ : n ≠ 0) :
25+
(cos x) ^ n - (sin x) ^ n = 1
26+
(∃ k : ℤ, k * π = x) ∧ Even n ∨ (∃ k : ℤ, k * (2 * π) = x) ∧ Odd n ∨
27+
(∃ k : ℤ, -(π / 2) + k * (2 * π) = x) ∧ Odd n := by
28+
constructor
29+
· intro h
30+
rcases eq_or_ne (sin x) 0 with hsinx | hsinx
31+
· rw [hsinx, zero_pow h₀, sub_zero, pow_eq_one_iff_of_ne_zero h₀, cos_eq_one_iff,
32+
cos_eq_neg_one_iff] at h
33+
rcases h with ⟨k, rfl⟩ | ⟨⟨k, rfl⟩, hn⟩
34+
· cases n.even_or_odd with
35+
| inl hn => refine .inl ⟨⟨k * 2, ?_⟩, hn⟩; simp [mul_assoc]
36+
| inr hn => exact .inr <| .inl ⟨⟨_, rfl⟩, hn⟩
37+
· exact .inl ⟨⟨2 * k + 1, by push_cast; ring⟩, hn⟩
38+
· rcases eq_or_ne (cos x) 0 with hcosx | hcosx
39+
· right; right
40+
rw [hcosx, zero_pow h₀, zero_sub, ← neg_inj, neg_neg, pow_eq_neg_one_iff,
41+
sin_eq_neg_one_iff] at h
42+
simpa only [eq_comm] using h
43+
· have hcos1 : |cos x| < 1 := by
44+
rw [abs_cos_eq_sqrt_one_sub_sin_sq, sqrt_lt' one_pos]
45+
simp [sq_pos_of_ne_zero hsinx]
46+
have hsin1 : |sin x| < 1 := by
47+
rw [abs_sin_eq_sqrt_one_sub_cos_sq, sqrt_lt' one_pos]
48+
simp [sq_pos_of_ne_zero hcosx]
49+
match n with
50+
| 1 =>
51+
rw [pow_one, pow_one, sub_eq_iff_eq_add] at h
52+
have : 2 * sin x * cos x = 0 := by
53+
simpa [h, add_sq, add_assoc, ← two_mul, mul_add, mul_assoc, ← sq]
54+
using cos_sq_add_sin_sq x
55+
simp [hsinx, hcosx] at this
56+
| 2 =>
57+
rw [← cos_sq_add_sin_sq x, sub_eq_add_neg, add_right_inj, neg_eq_self ℝ] at h
58+
exact absurd (pow_eq_zero h) hsinx
59+
| (n + 1 + 2) =>
60+
set m := n + 1
61+
refine absurd ?_ h.not_lt
62+
calc
63+
(cos x) ^ (m + 2) - (sin x) ^ (m + 2) ≤ |cos x| ^ (m + 2) + |sin x| ^ (m + 2) := by
64+
simp only [← abs_pow, sub_eq_add_neg]
65+
gcongr
66+
exacts [le_abs_self _, neg_le_abs _]
67+
_ = |cos x| ^ m * cos x ^ 2 + |sin x| ^ m * sin x ^ 2 := by simp [pow_add]
68+
_ < 1 ^ m * cos x ^ 2 + 1 ^ m * sin x ^ 2 := by gcongr
69+
_ = 1 := by simp
70+
· rintro (⟨⟨k, rfl⟩, hn⟩ | ⟨⟨k, rfl⟩, -⟩ | ⟨⟨k, rfl⟩, hn⟩)
71+
· rw [sin_int_mul_pi, zero_pow h₀, sub_zero, ← hn.pow_abs, abs_cos_int_mul_pi, one_pow]
72+
· have : sin (k * (2 * π)) = 0 := by simpa [mul_assoc] using sin_int_mul_pi (k * 2)
73+
simp [h₀, this]
74+
· simp [hn.neg_pow, h₀]

Mathlib/Analysis/SpecialFunctions/Trigonometric/Basic.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,10 @@ theorem cos_antiperiodic : Function.Antiperiodic cos π := by simp [cos_add]
301301
theorem cos_periodic : Function.Periodic cos (2 * π) :=
302302
cos_antiperiodic.periodic_two_mul
303303

304+
@[simp]
305+
theorem abs_cos_int_mul_pi (k : ℤ) : |cos (k * π)| = 1 := by
306+
simp [abs_cos_eq_sqrt_one_sub_sin_sq]
307+
304308
@[simp]
305309
theorem cos_add_pi (x : ℝ) : cos (x + π) = -cos x :=
306310
cos_antiperiodic x

0 commit comments

Comments
 (0)