@@ -719,15 +719,6 @@ by rw [← mul_self_eq_one_iff, ← sin_sq_add_cos_sq x,
719
719
pow_two, pow_two, ← sub_eq_iff_eq_add, sub_self];
720
720
exact ⟨λ h, by rw [h, mul_zero], eq_zero_of_mul_self_eq_zero ∘ eq.symm⟩
721
721
722
- theorem sin_sub_sin (θ ψ : ℝ) : sin θ - sin ψ = 2 * sin((θ - ψ)/2 ) * cos((θ + ψ)/2 ) :=
723
- begin
724
- have s1 := sin_add ((θ + ψ) / 2 ) ((θ - ψ) / 2 ),
725
- have s2 := sin_sub ((θ + ψ) / 2 ) ((θ - ψ) / 2 ),
726
- rw [div_add_div_same, add_sub, add_right_comm, add_sub_cancel, add_self_div_two] at s1,
727
- rw [div_sub_div_same, ←sub_add, add_sub_cancel', add_self_div_two] at s2,
728
- rw [s1, s2, ←sub_add, add_sub_cancel', ← two_mul, ← mul_assoc, mul_right_comm]
729
- end
730
-
731
722
lemma cos_eq_one_iff (x : ℝ) : cos x = 1 ↔ ∃ n : ℤ, (n : ℝ) * (2 * π) = x :=
732
723
⟨λ h, let ⟨n, hn⟩ := sin_eq_zero_iff.1 (sin_eq_zero_iff_cos_eq.2 (or.inl h)) in
733
724
⟨n / 2 , (int.mod_two_eq_zero_or_one n).elim
@@ -751,25 +742,16 @@ lemma cos_eq_one_iff_of_lt_of_lt {x : ℝ} (hx₁ : -(2 * π) < x) (hx₂ : x <
751
742
end ,
752
743
λ h, by simp [h]⟩
753
744
754
- theorem cos_sub_cos (θ ψ : ℝ) : cos θ - cos ψ = -2 * sin((θ + ψ)/2 ) * sin((θ - ψ)/2 ) :=
755
- by rw [← sin_pi_div_two_sub, ← sin_pi_div_two_sub, sin_sub_sin, sub_sub_sub_cancel_left,
756
- add_sub, sub_add_eq_add_sub, add_halves, sub_sub, sub_div π, cos_pi_div_two_sub,
757
- ← neg_sub, neg_div, sin_neg, ← neg_mul_eq_mul_neg, neg_mul_eq_neg_mul, mul_right_comm]
758
-
759
745
lemma cos_lt_cos_of_nonneg_of_le_pi_div_two {x y : ℝ} (hx₁ : 0 ≤ x) (hy₂ : y ≤ π / 2 ) (hxy : x < y) :
760
746
cos y < cos x :=
761
- calc cos y = cos x * cos (y - x) - sin x * sin (y - x) :
762
- by rw [← cos_add, add_sub_cancel'_right]
763
- ... < (cos x * 1 ) - sin x * sin (y - x) :
764
- sub_lt_sub_right ((mul_lt_mul_left
765
- (cos_pos_of_mem_Ioo (lt_of_lt_of_le (neg_neg_of_pos pi_div_two_pos) hx₁)
766
- (lt_of_lt_of_le hxy hy₂))).2
767
- (lt_of_le_of_ne (cos_le_one _) (mt (cos_eq_one_iff_of_lt_of_lt
768
- (show -(2 * π) < y - x, by linarith) (show y - x < 2 * π, by linarith)).1
769
- (sub_ne_zero.2 (ne_of_lt hxy).symm)))) _
770
- ... ≤ _ : by rw mul_one;
771
- exact sub_le_self _ (mul_nonneg (sin_nonneg_of_nonneg_of_le_pi hx₁ (by linarith))
772
- (sin_nonneg_of_nonneg_of_le_pi (by linarith) (by linarith)))
747
+ begin
748
+ rw [← sub_lt_zero, cos_sub_cos],
749
+ have : 0 < sin ((y + x) / 2 ),
750
+ { refine sin_pos_of_pos_of_lt_pi _ _; linarith },
751
+ have : 0 < sin ((y - x) / 2 ),
752
+ { refine sin_pos_of_pos_of_lt_pi _ _; linarith },
753
+ nlinarith,
754
+ end
773
755
774
756
lemma cos_lt_cos_of_nonneg_of_le_pi {x y : ℝ} (hx₁ : 0 ≤ x) (hy₂ : y ≤ π) (hxy : x < y) :
775
757
cos y < cos x :=
@@ -999,6 +981,75 @@ by { transitivity cos (pi / 2 ^ 5), congr, norm_num, simp }
999
981
lemma sin_pi_div_thirty_two : sin (pi / 32 ) = sqrt (2 - sqrt (2 + sqrt (2 + sqrt 2 ))) / 2 :=
1000
982
by { transitivity sin (pi / 2 ^ 5 ), congr, norm_num, simp }
1001
983
984
+ -- This section is also a convenient location for other explicit values of `sin` and `cos`.
985
+
986
+ /-- The cosine of `π / 3` is `1 / 2`. -/
987
+ lemma cos_pi_div_three : cos (π / 3 ) = 1 / 2 :=
988
+ begin
989
+ have h₁ : (2 * cos (π / 3 ) - 1 ) ^ 2 * (2 * cos (π / 3 ) + 2 ) = 0 ,
990
+ { have : cos (3 * (π / 3 )) = cos π := by { congr' 1 , ring },
991
+ linarith [cos_pi, cos_three_mul (π / 3 )] },
992
+ cases mul_eq_zero.mp h₁ with h h,
993
+ { linarith [pow_eq_zero h] },
994
+ { have : cos π < cos (π / 3 ),
995
+ { refine cos_lt_cos_of_nonneg_of_le_pi _ rfl.ge _;
996
+ linarith [pi_pos] },
997
+ linarith [cos_pi] }
998
+ end
999
+
1000
+ /-- The square of the cosine of `π / 6` is `3 / 4` (this is sometimes more convenient than the
1001
+ result for cosine itself). -/
1002
+ lemma square_cos_pi_div_six : cos (π / 6 ) ^ 2 = 3 / 4 :=
1003
+ begin
1004
+ have h1 : cos (π / 6 ) ^ 2 = 1 / 2 + 1 / 2 / 2 ,
1005
+ { convert cos_square (π / 6 ),
1006
+ have h2 : 2 * (π / 6 ) = π / 3 := by cancel_denoms,
1007
+ rw [h2, cos_pi_div_three] },
1008
+ rw ← sub_eq_zero at h1 ⊢,
1009
+ convert h1 using 1 ,
1010
+ ring
1011
+ end
1012
+
1013
+ /-- The cosine of `π / 6` is `√3 / 2`. -/
1014
+ lemma cos_pi_div_six : cos (π / 6 ) = (sqrt 3 ) / 2 :=
1015
+ begin
1016
+ suffices : sqrt 3 = cos (π / 6 ) * 2 ,
1017
+ { field_simp [(by norm_num : 0 ≠ 2 )], exact this.symm },
1018
+ rw sqrt_eq_iff_sqr_eq,
1019
+ { have h1 := (mul_right_inj' (by norm_num : (4 :ℝ) ≠ 0 )).mpr square_cos_pi_div_six,
1020
+ rw ← sub_eq_zero at h1 ⊢,
1021
+ convert h1 using 1 ,
1022
+ ring },
1023
+ { norm_num },
1024
+ { have : 0 < cos (π / 6 ) := by { apply cos_pos_of_mem_Ioo; linarith [pi_pos] },
1025
+ linarith },
1026
+ end
1027
+
1028
+ /-- The sine of `π / 6` is `1 / 2`. -/
1029
+ lemma sin_pi_div_six : sin (π / 6 ) = 1 / 2 :=
1030
+ begin
1031
+ rw [← cos_pi_div_two_sub, ← cos_pi_div_three],
1032
+ congr,
1033
+ ring
1034
+ end
1035
+
1036
+ /-- The square of the sine of `π / 3` is `3 / 4` (this is sometimes more convenient than the
1037
+ result for cosine itself). -/
1038
+ lemma square_sin_pi_div_three : sin (π / 3 ) ^ 2 = 3 / 4 :=
1039
+ begin
1040
+ rw [← cos_pi_div_two_sub, ← square_cos_pi_div_six],
1041
+ congr,
1042
+ ring
1043
+ end
1044
+
1045
+ /-- The sine of `π / 3` is `√3 / 2`. -/
1046
+ lemma sin_pi_div_three : sin (π / 3 ) = (sqrt 3 ) / 2 :=
1047
+ begin
1048
+ rw [← cos_pi_div_two_sub, ← cos_pi_div_six],
1049
+ congr,
1050
+ ring
1051
+ end
1052
+
1002
1053
end cos_div_pow_two
1003
1054
1004
1055
/-- The type of angles -/
@@ -1659,40 +1710,40 @@ by simp [two_mul, sin_add]
1659
1710
@[simp] lemma cos_two_pi : cos (2 * π) = 1 :=
1660
1711
by simp [two_mul, cos_add]
1661
1712
1662
- lemma sin_add_pi (x : ℝ ) : sin (x + π) = -sin x :=
1713
+ lemma sin_add_pi (x : ℂ ) : sin (x + π) = -sin x :=
1663
1714
by simp [sin_add]
1664
1715
1665
- lemma sin_add_two_pi (x : ℝ ) : sin (x + 2 * π) = sin x :=
1716
+ lemma sin_add_two_pi (x : ℂ ) : sin (x + 2 * π) = sin x :=
1666
1717
by simp [sin_add_pi, sin_add, sin_two_pi, cos_two_pi]
1667
1718
1668
- lemma cos_add_two_pi (x : ℝ ) : cos (x + 2 * π) = cos x :=
1719
+ lemma cos_add_two_pi (x : ℂ ) : cos (x + 2 * π) = cos x :=
1669
1720
by simp [cos_add, cos_two_pi, sin_two_pi]
1670
1721
1671
- lemma sin_pi_sub (x : ℝ ) : sin (π - x) = sin x :=
1722
+ lemma sin_pi_sub (x : ℂ ) : sin (π - x) = sin x :=
1672
1723
by simp [sub_eq_add_neg, sin_add]
1673
1724
1674
- lemma cos_add_pi (x : ℝ ) : cos (x + π) = -cos x :=
1725
+ lemma cos_add_pi (x : ℂ ) : cos (x + π) = -cos x :=
1675
1726
by simp [cos_add]
1676
1727
1677
- lemma cos_pi_sub (x : ℝ ) : cos (π - x) = -cos x :=
1728
+ lemma cos_pi_sub (x : ℂ ) : cos (π - x) = -cos x :=
1678
1729
by simp [sub_eq_add_neg, cos_add]
1679
1730
1680
- lemma sin_add_pi_div_two (x : ℝ ) : sin (x + π / 2 ) = cos x :=
1731
+ lemma sin_add_pi_div_two (x : ℂ ) : sin (x + π / 2 ) = cos x :=
1681
1732
by simp [sin_add]
1682
1733
1683
- lemma sin_sub_pi_div_two (x : ℝ ) : sin (x - π / 2 ) = -cos x :=
1734
+ lemma sin_sub_pi_div_two (x : ℂ ) : sin (x - π / 2 ) = -cos x :=
1684
1735
by simp [sub_eq_add_neg, sin_add]
1685
1736
1686
- lemma sin_pi_div_two_sub (x : ℝ ) : sin (π / 2 - x) = cos x :=
1737
+ lemma sin_pi_div_two_sub (x : ℂ ) : sin (π / 2 - x) = cos x :=
1687
1738
by simp [sub_eq_add_neg, sin_add]
1688
1739
1689
- lemma cos_add_pi_div_two (x : ℝ ) : cos (x + π / 2 ) = -sin x :=
1740
+ lemma cos_add_pi_div_two (x : ℂ ) : cos (x + π / 2 ) = -sin x :=
1690
1741
by simp [cos_add]
1691
1742
1692
- lemma cos_sub_pi_div_two (x : ℝ ) : cos (x - π / 2 ) = sin x :=
1743
+ lemma cos_sub_pi_div_two (x : ℂ ) : cos (x - π / 2 ) = sin x :=
1693
1744
by simp [sub_eq_add_neg, cos_add]
1694
1745
1695
- lemma cos_pi_div_two_sub (x : ℝ ) : cos (π / 2 - x) = sin x :=
1746
+ lemma cos_pi_div_two_sub (x : ℂ ) : cos (π / 2 - x) = sin x :=
1696
1747
by rw [← cos_neg, neg_sub, cos_sub_pi_div_two]
1697
1748
1698
1749
lemma sin_nat_mul_pi (n : ℕ) : sin (n * π) = 0 :=
@@ -1733,6 +1784,63 @@ end
1733
1784
theorem cos_ne_zero_iff {θ : ℂ} : cos θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ (2 * k + 1 ) * π / 2 :=
1734
1785
by rw [← not_exists, not_iff_not, cos_eq_zero_iff]
1735
1786
1787
+ theorem sin_eq_zero_iff {θ : ℂ} : sin θ = 0 ↔ ∃ k : ℤ, θ = k * π :=
1788
+ begin
1789
+ rw [← complex.cos_sub_pi_div_two, cos_eq_zero_iff],
1790
+ split,
1791
+ { rintros ⟨k, hk⟩,
1792
+ use k + 1 ,
1793
+ field_simp [eq_add_of_sub_eq hk],
1794
+ ring },
1795
+ { rintros ⟨k, rfl⟩,
1796
+ use k - 1 ,
1797
+ field_simp,
1798
+ ring }
1799
+ end
1800
+
1801
+ theorem sin_ne_zero_iff {θ : ℂ} : sin θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ k * π :=
1802
+ by rw [← not_exists, not_iff_not, sin_eq_zero_iff]
1803
+
1804
+ lemma cos_eq_cos_iff {x y : ℂ} :
1805
+ cos x = cos y ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = 2 * k * π - x :=
1806
+ calc cos x = cos y ↔ cos x - cos y = 0 : sub_eq_zero.symm
1807
+ ... ↔ -2 * sin((x + y)/2 ) * sin((x - y)/2 ) = 0 : by rw cos_sub_cos
1808
+ ... ↔ sin((x + y)/2 ) = 0 ∨ sin((x - y)/2 ) = 0 : by { field_simp [(by norm_num : -(2 :ℂ) ≠ 0 )] }
1809
+ ... ↔ sin((x - y)/2 ) = 0 ∨ sin((x + y)/2 ) = 0 : or.comm
1810
+ ... ↔ (∃ k : ℤ, y = 2 * k * π + x) ∨ (∃ k :ℤ, y = 2 * k * π - x) :
1811
+ begin
1812
+ apply or_congr;
1813
+ rw sin_eq_zero_iff;
1814
+ field_simp [(by norm_num : -(2 :ℂ) ≠ 0 )],
1815
+ work_on_goal 0 -- material specific to the left of the `or`, when x ≅ y mod 2π
1816
+ { split,
1817
+ all_goals
1818
+ { rintros ⟨k, hk⟩,
1819
+ refine ⟨-k, eq.symm _⟩ } },
1820
+ work_on_goal 2 -- material specific to the right of the `or`, when x ≅ -y mod 2π
1821
+ { refine exists_congr (λ k, ⟨λ hk, _, λ hk, _⟩) },
1822
+ all_goals -- joint material for showing two equations differ by a constant
1823
+ { rw ← sub_eq_zero at hk ⊢,
1824
+ convert hk using 1 ,
1825
+ try { push_cast },
1826
+ ring }
1827
+ end
1828
+ ... ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = 2 * k * π - x : exists_or_distrib.symm
1829
+
1830
+ lemma sin_eq_sin_iff {x y : ℂ} :
1831
+ sin x = sin y ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = (2 * k + 1 ) * π - x :=
1832
+ begin
1833
+ rw [←complex.cos_sub_pi_div_two, ←complex.cos_sub_pi_div_two, cos_eq_cos_iff],
1834
+ simp only [exists_or_distrib],
1835
+ apply or_congr;
1836
+ refine exists_congr (λ k, ⟨_, _⟩);
1837
+ { intros h,
1838
+ rw ← sub_eq_zero at ⊢ h,
1839
+ convert h using 1 ,
1840
+ field_simp,
1841
+ ring },
1842
+ end
1843
+
1736
1844
lemma has_deriv_at_tan {x : ℂ} (h : ∀ k : ℤ, x ≠ (2 * k + 1 ) * π / 2 ) :
1737
1845
has_deriv_at tan (1 / (cos x)^2 ) x :=
1738
1846
begin
@@ -1770,6 +1878,24 @@ end
1770
1878
theorem cos_ne_zero_iff {θ : ℝ} : cos θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ (2 * k + 1 ) * π / 2 :=
1771
1879
by rw [← not_exists, not_iff_not, cos_eq_zero_iff]
1772
1880
1881
+ lemma cos_eq_cos_iff {x y : ℝ} :
1882
+ cos x = cos y ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = 2 * k * π - x :=
1883
+ begin
1884
+ have := @complex.cos_eq_cos_iff x y,
1885
+ rw [← complex.of_real_cos, ← complex.of_real_cos] at this ,
1886
+ norm_cast at this ,
1887
+ simp [this ],
1888
+ end
1889
+
1890
+ lemma sin_eq_sin_iff {x y : ℝ} :
1891
+ sin x = sin y ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = (2 * k + 1 ) * π - x :=
1892
+ begin
1893
+ have := @complex.sin_eq_sin_iff x y,
1894
+ rw [← complex.of_real_sin, ← complex.of_real_sin] at this ,
1895
+ norm_cast at this ,
1896
+ simp [this ],
1897
+ end
1898
+
1773
1899
lemma has_deriv_at_tan {x : ℝ} (h : ∀ k : ℤ, x ≠ (2 * k + 1 ) * π / 2 ) :
1774
1900
has_deriv_at tan (1 / (cos x)^2 ) x :=
1775
1901
begin
0 commit comments