# Partial sums of geometric series #

This file determines the values of the geometric series $\sum_{i=0}^{n-1} x^i$ and $\sum_{i=0}^{n-1} x^i y^{n-1-i}$ and variants thereof. We also provide some bounds on the "geometric" sum of a/b^i where a b : ℕ.

## Main statements #

• geom_sum_Ico proves that $\sum_{i=m}^{n-1} x^i=\frac{x^n-x^m}{x-1}$ in a division ring.
• geom_sum₂_Ico proves that $\sum_{i=m}^{n-1} x^iy^{n - 1 - i}=\frac{x^n-y^{n-m}x^m}{x-y}$ in a field.

Several variants are recorded, generalising in particular to the case of a noncommutative ring in which x and y commute. Even versions not using division or subtraction, valid in each semiring, are recorded.

theorem geom_sum_succ {α : Type u} [] {x : α} {n : } :
iFinset.range (n + 1), x ^ i = x * i, x ^ i + 1
theorem geom_sum_succ' {α : Type u} [] {x : α} {n : } :
iFinset.range (n + 1), x ^ i = x ^ n + i, x ^ i
theorem geom_sum_zero {α : Type u} [] (x : α) :
i, x ^ i = 0
theorem geom_sum_one {α : Type u} [] (x : α) :
i, x ^ i = 1
@[simp]
theorem geom_sum_two {α : Type u} [] {x : α} :
i, x ^ i = x + 1
@[simp]
theorem zero_geom_sum {α : Type u} [] {n : } :
i, 0 ^ i = if n = 0 then 0 else 1
theorem one_geom_sum {α : Type u} [] (n : ) :
i, 1 ^ i = n
theorem op_geom_sum {α : Type u} [] (x : α) (n : ) :
MulOpposite.op (∑ i, x ^ i) = i,
@[simp]
theorem op_geom_sum₂ {α : Type u} [] (x : α) (y : α) (n : ) :
i, ^ (n - 1 - i) * = i, * ^ (n - 1 - i)
theorem geom_sum₂_with_one {α : Type u} [] (x : α) (n : ) :
i, x ^ i * 1 ^ (n - 1 - i) = i, x ^ i
theorem Commute.geom_sum₂_mul_add {α : Type u} [] {x : α} {y : α} (h : Commute x y) (n : ) :
(∑ i, (x + y) ^ i * y ^ (n - 1 - i)) * x + y ^ n = (x + y) ^ n

$x^n-y^n = (x-y) \sum x^ky^{n-1-k}$ reformulated without - signs.

@[simp]
theorem neg_one_geom_sum {α : Type u} [Ring α] {n : } :
i, (-1) ^ i = if Even n then 0 else 1
theorem geom_sum₂_self {α : Type u_1} [] (x : α) (n : ) :
i, x ^ i * x ^ (n - 1 - i) = n * x ^ (n - 1)
theorem geom_sum₂_mul_add {α : Type u} [] (x : α) (y : α) (n : ) :
(∑ i, (x + y) ^ i * y ^ (n - 1 - i)) * x + y ^ n = (x + y) ^ n

$x^n-y^n = (x-y) \sum x^ky^{n-1-k}$ reformulated without - signs.

theorem geom_sum_mul_add {α : Type u} [] (x : α) (n : ) :
(∑ i, (x + 1) ^ i) * x + 1 = (x + 1) ^ n
theorem Commute.geom_sum₂_mul {α : Type u} [Ring α] {x : α} {y : α} (h : Commute x y) (n : ) :
(∑ i, x ^ i * y ^ (n - 1 - i)) * (x - y) = x ^ n - y ^ n
theorem Commute.mul_neg_geom_sum₂ {α : Type u} [Ring α] {x : α} {y : α} (h : Commute x y) (n : ) :
(y - x) * i, x ^ i * y ^ (n - 1 - i) = y ^ n - x ^ n
theorem Commute.mul_geom_sum₂ {α : Type u} [Ring α] {x : α} {y : α} (h : Commute x y) (n : ) :
(x - y) * i, x ^ i * y ^ (n - 1 - i) = x ^ n - y ^ n
theorem geom_sum₂_mul {α : Type u} [] (x : α) (y : α) (n : ) :
(∑ i, x ^ i * y ^ (n - 1 - i)) * (x - y) = x ^ n - y ^ n
theorem Commute.sub_dvd_pow_sub_pow {α : Type u} [Ring α] {x : α} {y : α} (h : Commute x y) (n : ) :
x - y x ^ n - y ^ n
theorem sub_dvd_pow_sub_pow {α : Type u} [] (x : α) (y : α) (n : ) :
x - y x ^ n - y ^ n
theorem nat_sub_dvd_pow_sub_pow (x : ) (y : ) (n : ) :
x - y x ^ n - y ^ n
theorem one_sub_dvd_one_sub_pow {α : Type u} [Ring α] (x : α) (n : ) :
1 - x 1 - x ^ n
theorem sub_one_dvd_pow_sub_one {α : Type u} [Ring α] (x : α) (n : ) :
x - 1 x ^ n - 1
theorem pow_one_sub_dvd_pow_mul_sub_one {α : Type u} [Ring α] (x : α) (m : ) (n : ) :
x ^ m - 1 x ^ (m * n) - 1
theorem nat_pow_one_sub_dvd_pow_mul_sub_one (x : ) (m : ) (n : ) :
x ^ m - 1 x ^ (m * n) - 1
theorem Odd.add_dvd_pow_add_pow {α : Type u} [] (x : α) (y : α) {n : } (h : Odd n) :
x + y x ^ n + y ^ n
theorem Odd.nat_add_dvd_pow_add_pow (x : ) (y : ) {n : } (h : Odd n) :
x + y x ^ n + y ^ n
theorem geom_sum_mul {α : Type u} [Ring α] (x : α) (n : ) :
(∑ i, x ^ i) * (x - 1) = x ^ n - 1
theorem mul_geom_sum {α : Type u} [Ring α] (x : α) (n : ) :
(x - 1) * i, x ^ i = x ^ n - 1
theorem geom_sum_mul_neg {α : Type u} [Ring α] (x : α) (n : ) :
(∑ i, x ^ i) * (1 - x) = 1 - x ^ n
theorem mul_neg_geom_sum {α : Type u} [Ring α] (x : α) (n : ) :
(1 - x) * i, x ^ i = 1 - x ^ n
theorem Commute.geom_sum₂_comm {α : Type u} [] {x : α} {y : α} (n : ) (h : Commute x y) :
i, x ^ i * y ^ (n - 1 - i) = i, y ^ i * x ^ (n - 1 - i)
theorem geom_sum₂_comm {α : Type u} [] (x : α) (y : α) (n : ) :
i, x ^ i * y ^ (n - 1 - i) = i, y ^ i * x ^ (n - 1 - i)
theorem Commute.geom_sum₂ {α : Type u} [] {x : α} {y : α} (h' : Commute x y) (h : x y) (n : ) :
i, x ^ i * y ^ (n - 1 - i) = (x ^ n - y ^ n) / (x - y)
theorem geom₂_sum {α : Type u} [] {x : α} {y : α} (h : x y) (n : ) :
i, x ^ i * y ^ (n - 1 - i) = (x ^ n - y ^ n) / (x - y)
theorem geom_sum_eq {α : Type u} [] {x : α} (h : x 1) (n : ) :
i, x ^ i = (x ^ n - 1) / (x - 1)
theorem Commute.mul_geom_sum₂_Ico {α : Type u} [Ring α] {x : α} {y : α} (h : Commute x y) {m : } {n : } (hmn : m n) :
(x - y) * i, x ^ i * y ^ (n - 1 - i) = x ^ n - x ^ m * y ^ (n - m)
theorem Commute.geom_sum₂_succ_eq {α : Type u} [Ring α] {x : α} {y : α} (h : Commute x y) {n : } :
iFinset.range (n + 1), x ^ i * y ^ (n - i) = x ^ n + y * i, x ^ i * y ^ (n - 1 - i)
theorem geom_sum₂_succ_eq {α : Type u} [] (x : α) (y : α) {n : } :
iFinset.range (n + 1), x ^ i * y ^ (n - i) = x ^ n + y * i, x ^ i * y ^ (n - 1 - i)
theorem mul_geom_sum₂_Ico {α : Type u} [] (x : α) (y : α) {m : } {n : } (hmn : m n) :
(x - y) * i, x ^ i * y ^ (n - 1 - i) = x ^ n - x ^ m * y ^ (n - m)
theorem Commute.geom_sum₂_Ico_mul {α : Type u} [Ring α] {x : α} {y : α} (h : Commute x y) {m : } {n : } (hmn : m n) :
(∑ i, x ^ i * y ^ (n - 1 - i)) * (x - y) = x ^ n - y ^ (n - m) * x ^ m
theorem geom_sum_Ico_mul {α : Type u} [Ring α] (x : α) {m : } {n : } (hmn : m n) :
(∑ i, x ^ i) * (x - 1) = x ^ n - x ^ m
theorem geom_sum_Ico_mul_neg {α : Type u} [Ring α] (x : α) {m : } {n : } (hmn : m n) :
(∑ i, x ^ i) * (1 - x) = x ^ m - x ^ n
theorem Commute.geom_sum₂_Ico {α : Type u} [] {x : α} {y : α} (h : Commute x y) (hxy : x y) {m : } {n : } (hmn : m n) :
i, x ^ i * y ^ (n - 1 - i) = (x ^ n - y ^ (n - m) * x ^ m) / (x - y)
theorem geom_sum₂_Ico {α : Type u} [] {x : α} {y : α} (hxy : x y) {m : } {n : } (hmn : m n) :
i, x ^ i * y ^ (n - 1 - i) = (x ^ n - y ^ (n - m) * x ^ m) / (x - y)
theorem geom_sum_Ico {α : Type u} [] {x : α} (hx : x 1) {m : } {n : } (hmn : m n) :
i, x ^ i = (x ^ n - x ^ m) / (x - 1)
theorem geom_sum_Ico' {α : Type u} [] {x : α} (hx : x 1) {m : } {n : } (hmn : m n) :
i, x ^ i = (x ^ m - x ^ n) / (1 - x)
theorem geom_sum_Ico_le_of_lt_one {α : Type u} {x : α} (hx : 0 x) (h'x : x < 1) {m : } {n : } :
i, x ^ i x ^ m / (1 - x)
theorem geom_sum_inv {α : Type u} [] {x : α} (hx1 : x 1) (hx0 : x 0) (n : ) :
i, x⁻¹ ^ i = (x - 1)⁻¹ * (x - x⁻¹ ^ n * x)
theorem RingHom.map_geom_sum {α : Type u} {β : Type u_1} [] [] (x : α) (n : ) (f : α →+* β) :
f (∑ i, x ^ i) = i, f x ^ i
theorem RingHom.map_geom_sum₂ {α : Type u} {β : Type u_1} [] [] (x : α) (y : α) (n : ) (f : α →+* β) :
f (∑ i, x ^ i * y ^ (n - 1 - i)) = i, f x ^ i * f y ^ (n - 1 - i)

### Geometric sum with ℕ-division #

theorem Nat.pred_mul_geom_sum_le (a : ) (b : ) (n : ) :
(b - 1) * iFinset.range n.succ, a / b ^ i a * b - a / b ^ n
theorem Nat.geom_sum_le {b : } (hb : 2 b) (a : ) (n : ) :
i, a / b ^ i a * b / (b - 1)
theorem Nat.geom_sum_Ico_le {b : } (hb : 2 b) (a : ) (n : ) :
i, a / b ^ i a / (b - 1)
theorem geom_sum_pos {α : Type u} {n : } {x : α} (hx : 0 x) (hn : n 0) :
0 < i, x ^ i
theorem geom_sum_pos_and_lt_one {α : Type u} {n : } {x : α} (hx : x < 0) (hx' : 0 < x + 1) (hn : 1 < n) :
0 < i, x ^ i i, x ^ i < 1
theorem geom_sum_alternating_of_le_neg_one {α : Type u} {x : α} (hx : x + 1 0) (n : ) :
if Even n then i, x ^ i 0 else 1 i, x ^ i
theorem geom_sum_alternating_of_lt_neg_one {α : Type u} {n : } {x : α} (hx : x + 1 < 0) (hn : 1 < n) :
if Even n then i, x ^ i < 0 else 1 < i, x ^ i
theorem geom_sum_pos' {α : Type u} {n : } {x : α} (hx : 0 < x + 1) (hn : n 0) :
0 < i, x ^ i
theorem Odd.geom_sum_pos {α : Type u} {n : } {x : α} (h : Odd n) :
0 < i, x ^ i
theorem geom_sum_pos_iff {α : Type u} {n : } {x : α} (hn : n 0) :
0 < i, x ^ i Odd n 0 < x + 1
theorem geom_sum_ne_zero {α : Type u} {n : } {x : α} (hx : x -1) (hn : n 0) :
i, x ^ i 0
theorem geom_sum_eq_zero_iff_neg_one {α : Type u} {n : } {x : α} (hn : n 0) :
i, x ^ i = 0 x = -1 Even n
theorem geom_sum_neg_iff {α : Type u} {n : } {x : α} (hn : n 0) :
i, x ^ i < 0 Even n x + 1 < 0
theorem Nat.geomSum_eq {m : } (hm : 2 m) (n : ) :
k, m ^ k = (m ^ n - 1) / (m - 1)

Value of a geometric sum over the naturals. Note: see geom_sum_mul_add for a formulation that avoids division and subtraction.

theorem Nat.geomSum_lt {m : } {n : } {s : } (hm : 2 m) (hs : ks, k < n) :
ks, m ^ k < m ^ n

If all the elements of a finset of naturals are less than n, then the sum of their powers of m ≥ 2 is less than m ^ n.