import .common

open real topological_space filter polynomial
open_locale topology big_operators complex_conjugate filter ennreal

\begin{proof}

    It will suffice to show that for any $z_1, z_2, z_3, z_4 \in \mathbb{C}$ of modulus 1 such that $|3-z_1-z_2-z_3-z_4| = |z_1z_2z_3z_4|$, at least one of $z_1, z_2, z_3$ is equal to 1.

To this end, let $z_1=e^{\alpha i}, z_2=e^{\beta i}, z_3=e^{\gamma i}$ and

\[

f(\alpha, \beta, \gamma)=|3-z_1-z_2-z_3|^2-|1-z_1z_2z_3|^2.

\]

 A routine calculation shows that

\begin{align*}

f(\alpha, \beta, \gamma)&=

10 - 6\cos(\alpha) - 6\cos(\beta) - 6\cos(\gamma) \\

&\quad + 2\cos(\alpha + \beta + \gamma) + 2\cos(\alpha - \beta) \\

&\quad + 2\cos(\beta - \gamma) + 2\cos(\gamma - \alpha).

\end{align*}

Since the function $f$ is continuously differentiable, and periodic in each variable, $f$ has a maximum and a minimum and it attains these values only at points where $\nabla f=(0,0,0)$.  A routine calculation now shows that

\begin{align*}

\frac{\partial f}{\partial \alpha} + \frac{\partial f}{\partial \beta} + \frac{\partial f}{\partial \gamma} &=

6(\sin(\alpha) +\sin(\beta)+\sin(\gamma)-  \sin(\alpha + \beta + \gamma)) \\

&=

24\sin\left(\frac{\alpha+\beta}{2}\right) \sin\left(\frac{\beta+\gamma}{2}\right)

\sin\left(\frac{\gamma+\alpha}{2}\right).

\end{align*}

Hence every critical point of $f$ must satisfy one of $z_1z_2=1$, $z_2z_3=1$, or $z_3z_1=1$. By symmetry, let us assume that $z_1z_2=1$. Then

\[

f = |3-2\mathrm{Re}(z_1)-z_3|^2-|1-z_3|^2;

\]

since $3-2\mathrm{Re}(z_1)\ge 1$, $f$ is nonnegative and can be zero only if the real part of $z_1$, and hence also $z_1$ itself, is equal to $1$.

\end{proof}


theorem exercise_2018_b2 (n : ℕ) (hn : n > 0) (f : ℕ → ℂ → ℂ)
  (hf : ∀ n : ℕ, f n = λ z, (∑ (i : fin n), (n-i)* z^(i : ℕ))) :
  ¬ (∃ z : ℂ, ‖z‖ ≤ 1 ∧ f n z = 0) :=

Let $n$ be a positive integer, and let $f_{n}(z)=n+(n-1) z+$ $(n-2) z^{2}+\cdots+z^{n-1}$. Prove that $f_{n}$ has no roots in the closed unit disk $\{z \in \mathbb{C}:|z| \leq 1\}$.

\begin{proof}

    Note first that $f_n(1) > 0$, so $1$ is not a root of $f_n$.

Next, note that

\[

(z-1)f_n(z) = z^n + \cdots + z - n;

\]

however, for $\left| z \right| \leq 1$, we have

$\left| z^n + \cdots + z \right| \leq n$ by the triangle inequality;

equality can only occur if $z,\dots,z^n$ have norm 1 and the same argument, which only happens for $z=1$.

Thus there can be no root of $f_n$ with $|z| \leq 1$.

\end{proof}


Suppose that $f(x)=\sum_{i=0}^{\infty} c_{i} x^{i}$ is a power series for which each coefficient $c_{i}$ is 0 or 1 . Show that if $f(2 / 3)=3 / 2$, then $f(1 / 2)$ must be irrational.

\begin{proof}

    Suppose by way of contradiction that $f(1/2)$ is rational. Then $\sum_{i=0}^{\infty} c_i 2^{-i}$ is the binary expansion of a rational number, and hence must be eventually periodic; that is, there exist some integers $m,n$ such that

$c_i = c_{m+i}$ for all $i \geq n$. We may then write

\[

f(x) = \sum_{i=0}^{n-1} c_i x^i + \frac{x^n}{1-x^m} \sum_{i=0}^{m-1} c_{n+i} x^i.

\]

Evaluating at $x = 2/3$, we may equate $f(2/3) = 3/2$ with

\[

\frac{1}{3^{n-1}} \sum_{i=0}^{n-1} c_i 2^i 3^{n-i-1} + \frac{2^n 3^m}{3^{n+m-1}(3^m-2^m)} \sum_{i=0}^{m-1} c_{n+i} 2^i 3^{m-1-i};

\]

since all terms on the right-hand side have odd denominator, the same must be true of the sum, a contradiction.

\end{proof}


Prove that for each positive integer $n$, the number $10^{10^{10^n}}+10^{10^n}+10^n-1$ is not prime.

\begin{proof}

    Put

\[

N = 10^{10^{10^n}} + 10^{10^n} + 10^n - 1.

\]

Write $n = 2^m k$ with $m$ a nonnegative integer and $k$ a positive odd integer.

For any nonnegative integer $j$,

\[

10^{2^m j} \equiv (-1)^j \pmod{10^{2^m} + 1}.

\]

Since $10^n \geq n \geq 2^m \geq m+1$, $10^n$ is divisible by $2^n$ and hence by $2^{m+1}$,

and similarly $10^{10^n}$ is divisible by $2^{10^n}$ and hence by $2^{m+1}$. It follows that

\[

N \equiv 1 + 1 + (-1) + (-1) \equiv 0 \pmod{10^{2^m} + 1}.

\]

Since $N \geq 10^{10^n} > 10^n + 1 \geq 10^{2^m} + 1$, it follows that $N$ is composite.

\end{proof}


Prove that there exist infinitely many integers $n$ such that $n, n+1, n+2$ are each the sum of the squares of two integers.

\begin{proof}

    It is well-known that the equation $x^2-2y^2=1$ has infinitely

many solutions (the so-called ``Pell'' equation).  Thus setting

$n=2y^2$ (so that $n=y^2+y^2$, $n+1=x^2+0^2$, $n+2=x^2+1^2$)

yields infinitely many $n$ with the desired property.

\end{proof}


theorem exercise_1998_a3 (f : ℝ → ℝ) (hf : cont_diff ℝ 3 f) :
  ∃ a : ℝ, (f a) * (deriv f a) * (iterated_deriv 2 f a) * (iterated_deriv 3 f a) ≥ 0 :=

Let $f$ be a real function on the real line with continuous third derivative. Prove that there exists a point $a$ such that


theorem exercise_2_12a (f : ℕ → ℕ) (p : ℕ → ℝ) (a : ℝ)
  (hf : injective f) (hp : tendsto p at_top (𝓝 a)) :
  tendsto (λ n, p (f n)) at_top (𝓝 a) :=

import .common

open set real filter function ring_hom topological_space

open_locale big_operators
open_locale filter
open_locale topology
noncomputable theory

Let $(p_n)$ be a sequence and $f:\mathbb{N}\to\mathbb{N}$. The sequence $(q_k)_{k\in\mathbb{N}}$ with $q_k=p_{f(k)}$ is called a rearrangement of $(p_n)$. Show that if $f$ is an injection, the limit of a sequence is unaffected by rearrangement.

\begin{proof}

    Let $\varepsilon>0$. Since $p_n \rightarrow L$, we have that, for all $n$ except $n \leq N$, $d\left(p_n, L\right)<\epsilon$. Let $S=\{n \mid f(n) \leq N\}$, let $n_0$ be the largest $n \in S$, we know there is such a largest $n$ because $f(n)$ is injective. Now we have that $\forall n>n_0 f(n)>N$ which implies that $p_{f(n)} \rightarrow L$, as required.

\end{proof}


theorem exercise_2_29 (M : Type*) [metric_space M]
  (O C : set (set M))
  (hO : O = {s | is_open s})
  (hC : C = {s | is_closed s}) :
  ∃ f : O → C, bijective f :=

Let $\mathcal{T}$ be the collection of open subsets of a metric space $\mathrm{M}$, and $\mathcal{K}$ the collection of closed subsets. Show that there is a bijection from $\mathcal{T}$ onto $\mathcal{K}$.

\begin{proof}

   The bijection given by $x\mapsto X^C$ suffices.

\end{proof}


theorem exercise_2_41 (m : ℕ) {X : Type*} [normed_space ℝ ((fin m) → ℝ)] :
  is_compact (metric.closed_ball 0 1) :=

Let $\|\cdot\|$ be any norm on $\mathbb{R}^{m}$ and let $B=\left\{x \in \mathbb{R}^{m}:\|x\| \leq 1\right\}$. Prove that $B$ is compact.

\begin{proof}

    Let us call $\|\cdot\|_E$ the Euclidean norm in $\mathbb{R}^m$. We start by claiming that there exist constants $C_1, C_2>0$ such that

$$

C_1\|x\|_E \leq\|x\| \leq C_2\|x\|_E, \forall x \in \mathbb{R}^m .

$$

Assuming (1) to be true, let us finish the problem. First let us show that $B$ is bounded w.r.t. $d_E$, which is how we call the Euclidean distance in $\mathbb{R}^m$. Indeed, given $x \in B,\|x\|_E \leq \frac{1}{C_1}\|x\| \leq \frac{1}{C_1}$. Hence $B \subset\left\{x \in \mathbb{R}^m: d_E(x, 0)<\frac{1}{C_1}+1\right\}$, which means $B$ is bounded w.r.t $d_E$.

Now let us show that $B$ is closed w.r.t. $d_E$. Let $x_n \rightarrow x$ w.r.t. $d_E$, where $x_n \in B$. Notice that this implies that $x_n \rightarrow x$ w.r.t. $d(x, y)=\|x-y\|$, the distance coming from $\|\cdot\|$, since by (1) we have

$$

d\left(x_n, x\right)=\left\|x_n-x\right\| \leq C_2\left\|x_n-x\right\|_E \rightarrow 0 .

$$

Also, notice that

$$

\|x\| \leq\left\|x_n-x\right\|+\left\|x_n\right\| \leq\left\|x_n-x\right\|+1,

$$

hence passing to the limit we obtain that $\|x\| \leq 1$, therefore $x \in B$ and so $B$ is closed w.r.t. $d_E$. Since $B$ is closed and bounded w.r.t. $d_E$, it must be compact. Now we claim that the identity function, $i d:\left(\mathbb{R}^m, d_E\right) \rightarrow\left(\mathbb{R}^m, d\right)$ where $\left(\mathbb{R}^m, d_E\right)$ means we are using the distance $d_E$ in $\mathbb{R}^m$ and $\left(\mathbb{R}^m, d\right)$ means we are using the distance $d$ in $\mathbb{R}^m$, is a homeomorphism. This follows by (1), since $i d$ is always a bijection, and it is continuous and its inverse is continuous by (1) (if $x_n \rightarrow x$ w.r.t. $d_E$, then $x_n \rightarrow x$ w.r.t. $d$ and vice-versa, by (1)). By a result we saw in class, since $B$ is compact in $\left(\mathbb{R}^m, d_E\right)$ and $i d$ is a homeomorphism, then $i d(B)=B$ is compact w.r.t. $d$.

We are left with proving (1). Notice that it suffices to prove that $C_1 \leq\|x\| \leq$ $C_2, \forall x \in \mathbb{R}^m$ with $\|x\|_E=1$. Indeed, if this is true, given $x \in \mathbb{R}^m$, either $\|x\|_E=0$ (which implies $x=0$ and (1) holds in this case), or $x /\|x\|_E=y$ is such that $\|y\|_E=1$, so $C_1 \leq\|y\| \leq C_2$, which implies $C_1\|x\|_E \leq\|x\| \leq C_2\|x\|_E$.

We want to show now that $\|\cdot\|$ is continuous w.r.t. $d_E$, that is, given $\varepsilon>0$ and $x \in \mathbb{R}^m$, there exists $\delta>0$ such that if $d_E(x, y)<\delta$, then $\|\mid x\|-\|y\| \|<\varepsilon$.

By the triangle inequality, $\|x\|-\|y\| \leq\|x-y\|$, and $\|y\|-\|x\| \leq\|x-y\|$, therefore

$$

|\|x||-\| y|\|\leq\| x-y \| .

$$

Writing now $x=\sum_{i=1}^m a_i e_i, y=\sum_{i=1}^m b_i e_i$, where $e_i=(0, \ldots, 1,0, \ldots, 0)$ (with 1 in the i-th component), we obtain by the triangle inequality,

$$

\begin{aligned}

\|x-y\| & =\left\|\sum_{i=1}^m\left(a_i-b_i\right) e_i\right\| \leq \sum_{i=1}^m\left|a_i-b_i\left\|\left|\left\|e_i\right\| \leq \max _{i=1, \ldots, m}\left\|e_i\right\| \sum_{i=1}^m\right| a_i-b_i \mid\right.\right. \\

& =\max _{i=1, \ldots, m}\left\|e_i\right\| d_{s u m}(x, y) \leq \max _{i=1, \ldots, m}\left\|e_i\right\| m d_{\max }(x, y) \\

& \leq \max _{i=1, \ldots, m}\left\|e_i\right\| m d_E(x, y) .

\end{aligned}

$$

Let $\delta=\frac{\varepsilon}{m \max _{i=1, \ldots, m}\left\|e_i\right\|}$. Then if $d_E(x, y)<\delta,\|x\|-\|y\|||<\varepsilon$.

Since $\|\cdot\|$ is continuous w.r.t. $d_E$ and $K=\left\{x \in \mathbb{R}^m:\|x\|_E=1\right\}$ is compact w.r.t. $d_E$, then the function $\|\cdot\|$ achieves a maximum and a minimum value on $K$. Call $C_1=\min _{x \in K}\|x\|, C_2=\max _{x \in K}\|x\|$. Then

$$

C_1 \leq\|x\| \leq C_2, \forall x \in \mathbb{R}^m \text { such that }\|x\|_E=1,

$$

which is what we needed.

\end{proof}


theorem exercise_2_57 {X : Type*} [topological_space X]
  : ∃ (S : set X), is_connected S ∧ ¬ is_connected (interior S) :=

Show that if $S$ is connected, it is not true in general that its interior is connected.

\begin{proof}

    Consider $X=\mathbb{R}^2$ and

$$

A=([-2,0] \times[-2,0]) \cup([0,2] \times[0,2])

$$

which is connected, while $\operatorname{int}(A)$ is not connected.

To see this consider the continuous function $f: \mathbb{R}^2 \rightarrow \mathbb{R}$ is defined by $f(x, y)=x+y$. Let $U=f^{-1}(0,+\infty)$ which is open in $\mathbb{R}^2$ and so $U \cap \operatorname{int}(A)$ is open in $\operatorname{int}(A)$. Also, since $(0,0) \notin \operatorname{int}(A)$, so for all $(x, y) \in \operatorname{int}(A), f(x, y) \neq 0$ and $U \cap \operatorname{int}(A)=f^{-1}[0,+\infty) \cap \operatorname{int}(A)$ is closed in $\operatorname{int}(A)$. Furthermore, $(1,1)=f^{-1}(2) \in U \cap \operatorname{int}(A)$ shows that $U \cap \operatorname{int}(A) \neq \emptyset$ while $(-1,-1) \in \operatorname{int}(A)$ and $(-1,-1) \notin U$ shows that $U \cap \operatorname{int}(A) \neq \operatorname{int}(A)$.

\end{proof}


theorem exercise_2_126 {E : set ℝ}
  (hE : ¬ set.countable E) : ∃ (p : ℝ), cluster_pt p (𝓟 E) :=

Suppose that $E$ is an uncountable subset of $\mathbb{R}$. Prove that there exists a point $p \in \mathbb{R}$ at which $E$ condenses.

\begin{proof}

    I think this is the proof by contrapositive that you were getting at.

Suppose that $E$ has no limit points at all. Pick an arbitrary point $x \in E$. Then $x$ cannot be a limit point, so there must be some $\delta>0$ such that the ball of radius $\delta$ around $x$ contains no other points of $E$ :

$$

B_\delta(x) \cap E=\{x\}

$$

Call this "point 1 ". For the next point, take the closest element to $x$ and on its left; that is, choose the point

$$

\max [E \cap(-\infty, x)]

$$

if it exists (that is important - if not, skip to the next step). Note that by the argument above, this supremum, should it exist, cannot equal $x$ and is therefore a new point in $E$.

Call this "point 2 ". Now take the first point to the right of $x$ for "point 3 ". Take the first point to the left of point 2 for "point 4 ". And so on, ad infinitum.

This gives a countable list of unique points; we must show that it exhausts the entire set $E$. Suppose not. Suppose there is some element $a<x$ which is never included in the list (picking $a$ on the negative side of $x$ is arbitrary, and the same argument would work for the second case). Then the element closest and to the right of $a$ in $E$ (which exists, by the no-limit-points argument at the beginning) is also not in the list; if it was, $a$ would have been in one of the next two spots. And same with that point (call it $a_1$ ); there is a closest $a_2>a_1 \in E$ such that $a_2$ is not in the list. Repeating, we generate an infinite monotone-increasing sequence $\left\{a_i\right\}$ of elements in $E$ and not in the list, which is clearly bounded above by $x$. By the Monotone

Convergence Theorem this sequence has a limit. But that means the sequence $\left\{a_i\right\} \subset E$ converges to a limit, and hence $E$ has a limit point, contradicting the assumption. Therefore our list exhausts $E$, and we have enumerated all its elements.

\end{proof}


theorem exercise_3_4 (n : ℕ) :
  tendsto (λ n, (sqrt (n + 1) - sqrt n)) at_top (𝓝 0) :=

Prove that $\sqrt{n+1}-\sqrt{n} \rightarrow 0$ as $n \rightarrow \infty$.

\begin{proof}

    $$

\sqrt{n+1}-\sqrt{n}=\frac{(\sqrt{n+1}-\sqrt{n})(\sqrt{n+1}+\sqrt{n})}{\sqrt{n+1}+\sqrt{n}}=\frac{1}{\sqrt{n+1}+\sqrt{n}}<\frac{1}{2 \sqrt{n}}

$$

\end{proof}


theorem exercise_3_63b (p : ℝ) (f : ℕ → ℝ) (hp : p ≤ 1)
  (h : f = λ k, (1 : ℝ) / (k * (log k) ^ p)) :
  ¬ ∃ l, tendsto f at_top (𝓝 l) :=

Prove that $\sum 1/k(\log(k))^p$ diverges when $p \leq 1$.

\begin{proof}

    Using the integral test, for a set $a$, we see

$$

\lim _{b \rightarrow \infty} \int_a^b \frac{1}{x \log (x)^c} d x=\lim _{b \rightarrow \infty}\left(\frac{\log (b)^{1-c}}{1-c}-\frac{\log (a)^{1-c}}{1-c}\right)

$$

which goes to infinity if $c \leq 1$ and converges if $c>1$. Thus,

$$

\sum_{n=2}^{\infty} \frac{1}{n \log (n)^c}

$$

converges if and only if $c>1$.

\end{proof}


theorem exercise_2_1_18 {G : Type*} [group G]
  [fintype G] (hG2 : even (fintype.card G)) :
  ∃ (a : G), a ≠ 1 ∧ a = a⁻¹ :=

import .common

open set function nat fintype real subgroup ideal polynomial submodule zsqrtd
open char_p mul_aut matrix
open_locale big_operators
noncomputable theory

If $G$ is a finite group of even order, show that there must be an element $a \neq e$ such that $a=a^{-1}$.

\begin{proof}

    First note that $a=a^{-1}$ is the same as saying $a^2=e$, where $e$ is the identity. I.e. the statement is that there exists at least one element of order 2 in $G$.

Every element $a$ of $G$ of order at least 3 has an inverse $a^{-1}$ that is not itself -- that is, $a \neq a^{-1}$. So the subset of all such elements has an even cardinality (/size). There's exactly one element with order 1 : the identity $e^1=e$. So $G$ contains an even number of elements -call it $2 k$-- of which an even number are elements of order 3 or above -- call that $2 n$ where $n<k$-- and exactly one element of order 1 . Hence the number of elements of order 2 is

$$

2 k-2 n-1=2(k-n)-1

$$

This cannot equal 0 as $2(k-n)$ is even and 1 is odd. Hence there's at least one element of order 2 in $G$, which concludes the proof.

\end{proof}


theorem exercise_2_1_26 {G : Type*} [group G]
  [fintype G] (a : G) : ∃ (n : ℕ), a ^ n = 1 :=

If $G$ is a finite group, prove that, given $a \in G$, there is a positive integer $n$, depending on $a$, such that $a^n = e$.

\begin{proof}

    Because there are only a finite number of elements of $G$, it's clear that the set $\left\{a, a^2, a^3, \ldots\right\}$ must be a finite set and in particular, there should exist some $i$ and $j$ such that $i \neq j$ and $a^i=a^j$. WLOG suppose further that $i>j$ (just reverse the roles of $i$ and $j$ otherwise). Then multiply both sides by $\left(a^j\right)^{-1}=a^{-j}$ to get

$$

a^i * a^{-j}=a^{i-j}=e

$$

Thus the $n=i-j$ is a positive integer such that $a^n=e$.

\end{proof}


theorem exercise_2_2_3 {G : Type*} [group G]
  {P : ℕ → Prop} {hP : P = λ i, ∀ a b : G, (a*b)^i = a^i * b^i}
  (hP1 : ∃ n : ℕ, P n ∧ P (n+1) ∧ P (n+2)) : comm_group G :=

If $G$ is a group in which $(a b)^{i}=a^{i} b^{i}$ for three consecutive integers $i$, prove that $G$ is abelian.

\begin{proof}

    Let $G$ be a group, $a, b \in G$ and $i$ be any integer. Then from given condition,

$$

\begin{aligned}

(a b)^i & =a^i b^i \\

(a b)^{i+1} & =a^{i+1} b^{i+1} \\

(a b)^{i+2} & =a^{i+2} b^{i+2}

\end{aligned}

$$

From first and second, we get

$$

a^{i+1} b^{i+1}=(a b)^i(a b)=a^i b^i a b \Longrightarrow b^i a=a b^i

$$

From first and third, we get

$$

a^{i+2} b^{i+2}=(a b)^i(a b)^2=a^i b^i a b a b \Longrightarrow a^2 b^{i+1}=b^i a b a

$$

This gives

$$

a^2 b^{i+1}=a\left(a b^i\right) b=a b^i a b=b^i a^2 b

$$

Finally, we get

$$

b^i a b a=b^i a^2 b \Longrightarrow b a=a b

$$

This shows that $G$ is Abelian.

\end{proof}


theorem exercise_2_2_6c {G : Type*} [group G] {n : ℕ} (hn : n > 1)
  (h : ∀ (a b : G), (a * b) ^ n = a ^ n * b ^ n) :
  ∀ (a b : G), (a * b * a⁻¹ * b⁻¹) ^ (n * (n - 1)) = 1 :=

Let $G$ be a group in which $(a b)^{n}=a^{n} b^{n}$ for some fixed integer $n>1$ for all $a, b \in G$. For all $a, b \in G$, prove that $\left(a b a^{-1} b^{-1}\right)^{n(n-1)}=e$.

\begin{proof}

    We start with the following two intermediate results.

(1) $(a b)^{n-1}=b^{n-1} a^{n-1}$.

(2) $a^n b^{n-1}=b^{n-1} a^n$.

To prove (1), notice by the given condition for all $a, b \in G$

$(b a)^n=b^n a^n$, for some fixed integers $n>1$.

Then,

$(b a)^n=b^n a^n \Longrightarrow b .(a b)(a b) \ldots .(a b) . a=b\left(b^{n-1} a^{n-1}\right) a$, where $(a b)$ occurs $n-1$ times $\Longrightarrow(a b)^{n-1}=b^{n-1} a^{n-1}$, by cancellation law.

Hence, for all $a, b \in G$

$$

(a b)^{n-1}=b^{n-1} a^{n-1} .

$$

To prove (2), notice by the given condition for all $a, b \in G$

$(b a)^n=b^n a^n$, for some fixed integers $n>1$.

Then we have

$$

\begin{aligned}

& (b a)^n=b^n a^n \\

\Longrightarrow & b \cdot(a b)(a b) \ldots(a b) \cdot a=b\left(b^{n-1} a^{n-1}\right) a, \text { where }(a b) \text { occurs } n-1 \text { times } \\

\Longrightarrow & (a b)^{n-1}=b^{n-1} a^{n-1}, \text { by cancellation law } \\

\Longrightarrow & (a b)^{n-1}(a b)=\left(b^{n-1} a^{n-1}\right)(a b) \\

\Longrightarrow & (a b)^n=b^{n-1} a^n b \\

\Longrightarrow & a^n b^n=b^{n-1} a^n b, \text { given condition } \\

\Longrightarrow & a^n b^{n-1}=b^{n-1} a^n, \text { by cancellation law. }

\end{aligned}

$$

Therefore for all $a, b \in G$ we have

$$

a^n b^{n-1}=b^{n-1} a^n

$$

In order to show that

$$

\left(a b a^{-1} b^{-1}\right)^{n(n-1)}=e, \text { for all } a, b \in G

$$

it is enough to show that

$$

(a b)^{n(n-1)}=(b a)^{n(n-1)}, \quad \forall x, y \in G .

$$

Step 3

This is because of

$$

\begin{aligned}

(a b)^{n(n-1)}=(b a)^{n(n-1)} & \left.\Longrightarrow(b a)^{-1}\right)^{n(n-1)}(a b)^{n(n-1)}=e \\

& \Longrightarrow\left(a^{-1} b^{-1}\right)^{n(n-1)}(a b)^{n(n-1)}=e \\

& \Longrightarrow\left(\left(a^{-1} b^{-1}\right)^n\right)^{n-1}\left((a b)^n\right)(n-1)=e \\

& \Longrightarrow\left((a b)^n\left(a^{-1} b^{-1}\right)^n\right)^{n-1}=e, \text { by }(1) \\

& \Longrightarrow\left(a b a^{-1} b^{-1}\right)^{n(n-1)}=e, \text { ( given condition) }

\end{aligned}

$$

Now, it suffices to show that

$$

(a b)^{n(n-1)}=(b a)^{n(n-1)}, \quad \forall x, y \in G .

$$

Now, we have

$$

\begin{aligned}

(a b)^{n(n-1)} & =\left(a^n b^n\right)^{n-1}, \text { by the given condition } \\

& =\left(a^n b^{n-1} b\right)^{n-1} \\

& =\left(b^{n-1} a^n b\right)^{n-1}, \text { by }(2) \\

& =\left(a^n b\right)^{n-1}\left(b^{n-1}\right)^{n-1}, \text { by }(1) \\

& =b^{n-1}\left(a^n\right)^{n-1}\left(b^{n-1}\right)^{n-1}, \text { by }(1) \\

& =\left(b^{n-1}\left(a^{n-1}\right)^n\right)\left(b^{n-1}\right)^{n-1} \\

& =\left(a^{n-1}\right)^n b^{n-1}\left(b^{n-1}\right)^{n-1}, \text { by }(2) \\

& =\left(a^{n-1}\right)^n\left(b^{n-1}\right)^n \\

& =\left(a^{n-1} b^{n-1}\right)^n, \text { by }(1) \\

& =(b a)^{n(n-1)}, \text { by }(1) .

\end{aligned}

$$

This completes our proof.

\end{proof}


theorem exercise_2_3_16 {G : Type*} [group G]
  (hG : ∀ H : subgroup G, H = ⊤ ∨ H = ⊥) :
  is_cyclic G ∧ ∃ (p : ℕ) (fin : fintype G), nat.prime p ∧ @card G fin = p :=

If a group $G$ has no proper subgroups, prove that $G$ is cyclic of order $p$, where $p$ is a prime number.

\begin{proof}

    Case-1: $G=(e), e$ being the identity element in $G$. Then trivially $G$ is cyclic.

    Case-2: $G \neq(e)$. Then there exists an non-identity element in $G.$ Let us consider an non-identity element in $G$, say $a\neq (e)$. Now look at the cyclic subgroup generated by $a$, that is, $\langle a\rangle$. Since

    $a\neq (e) \in G,\langle a\rangle$ is a subgroup of $G$.

If $G \neq\langle a\rangle$ then $\langle a\rangle$ is a proper non-trivial subgroup of $G$, which is an impossibility. Therfore we must have

$$

G=\langle a\rangle .

$$

This implies, $G$ is a cyclic group generated by $a$. Then it follows that every non-identity element of $G$ is a generator of $G$. Now we claim that $G$ is finite.

\end{proof}


theorem exercise_2_5_23 {G : Type*} [group G]
  (hG : ∀ (H : subgroup G), H.normal) (a b : G) :
  ∃ (j : ℤ) , b*a = a^j * b:=

Let $G$ be a group such that all subgroups of $G$ are normal in $G$. If $a, b \in G$, prove that $ba = a^jb$ for some $j$.

\begin{proof}

    Let $G$ be a group where each subgroup is normal in $G$. let $a, b \in G$.

$$

\begin{aligned}

    \langle a\rangle\triangleright  G  &\Rightarrow b \cdot\langle a\rangle=\langle a\rangle \cdot b . \\

& \Rightarrow \quad b \cdot a=a^j \cdot b \text { for some } j \in \mathbb{Z}.

\end{aligned}

$$

(hence for $a_1 b \in G \quad a^j b=b \cdot a$ ).

\end{proof}


theorem exercise_2_5_31 {G : Type*} [comm_group G] [fintype G]
  {p m n : ℕ} (hp : nat.prime p) (hp1 : ¬ p ∣ m) (hG : card G = p^n*m)
  {H : subgroup G} [fintype H] (hH : card H = p^n) :
  characteristic H :=

Suppose that $G$ is an abelian group of order $p^nm$ where $p \nmid m$ is a prime.  If $H$ is a subgroup of $G$ of order $p^n$, prove that $H$ is a characteristic subgroup of $G$.

\begin{proof}

    Let $G$ be an abelian group of order $p^n m$, such that $p \nmid m$. Now, Given that $H$ is a subgroup of order $p^n$. Since $G$ is abelian $H$ is normal. Now we want to prove that $H$ is a characterestic subgroup, that is $\phi(H)=H$ for any automorphism $\phi$ of $G$. Now consider $\phi(H)$. Clearly $|\phi(H)|=p^n$. Suppose $\phi(H) \neq H$, then $|H \cap \phi(H)|=p^s$, where $s<n$. Consider $H \phi(H)$, this is a subgroup of $G$ as $H$ is normal. Also $|H \phi(H)|=\frac{|H||\phi(H)|}{|H \cap \phi(H)|}=\frac{p^{2 n}}{p^s}=p^{2 n-s}$, where $2 n-s>n$. By lagrange's theorem then $p^{2 n-s}\left|p^n m \Longrightarrow p^{n-s}\right| m \Longrightarrow p \mid m$-contradiction. So $\phi(H)=H$, and $H$ is characterestic subgroup of $G$.

\end{proof}


theorem exercise_2_5_43 (G : Type*) [group G] [fintype G]
  (hG : card G = 9) :
  comm_group G :=

Prove that a group of order 9 must be abelian.

\begin{proof}

    We use the result from problem 40 which is as follows: Suppose $G$ is a group, $H$ is a subgroup and $|G|=n$ and $n \nmid\left(i_G(H)\right) !$. Then there exists a normal subgroup $\$ K \backslash$ neq $\{$ e $\} \$$ and $K \subseteq H$.

So, we have now a group $G$ of order 9. Suppose that $G$ is cyclic, then $G$ is abelian and there is nothing more to prove. Suppose that $G$ s not cyclic,then there exists an element $a$ of order 3 , and $A=\langle a\rangle$. Now $i_G(A)=3$, now $9 \nmid 3$ !, hence by the above result there is a normal subgroup $K$, non-trivial and $K \subseteq A$. But $|A|=3$, a prime order subgroup, hence has no non-trivial subgroup, so $K=A$. So $A$ is normal subgroup. Now since $G$ is not cyclic any non-identity element is of order 3.So Let $a(\neq$ $e) \in G$.Consider $A=\langle a\rangle$. As shown before $A$ is normal. $a$ commutes with any if its powers. Now Let $b \in G$ such that $b \notin A$. Then $b a b^{-1} \in A$ and hence $b a b^{-1}=a^i$.This implies $a=b^3 a b^{-3}=a^{i^3} \Longrightarrow a^{i^3-1}=e$. So, 3 divides $i^3-1$. Also by fermat's little theorem 3 divides $i^2-1$.So 3 divides $i-1$. But $0 \leq i \leq 2$. So $i=1$, is the only possibility and hence $a b=b a$. So $a \in Z(G)$ as $b$ was arbitrary. Since $a$ was arbitrary $G=Z(G)$. Hence $G$ is abelian.

\end{proof}


theorem exercise_2_5_52 {G : Type*} [group G] [fintype G]
  (φ : G ≃* G) {I : finset G} (hI : ∀ x ∈ I, φ x = x⁻¹)
  (hI1 : 0.75 * card G ≤ card I) :
  ∀ x : G, φ x = x⁻¹ ∧ ∀ x y : G, x*y = y*x :=

Let $G$ be a finite group and $\varphi$ an automorphism of $G$ such that $\varphi(x) = x^{-1}$ for more than three-fourths of the elements of $G$. Prove that $\varphi(y) = y^{-1}$ for all $y \in G$, and so $G$ is abelian.

\begin{proof}

Let us start with considering $b$ to be an arbitrary element in $A$.

1. Show that $\left|A \cap\left(b^{-1} A\right)\right|>\frac{|G|}{2}$, where

$$

b^{-1} A=\left\{b^{-1} a \mid a \in A\right\}

$$

First notice that if we consider a map $f: A \rightarrow b^{-1} A$ defined by $f(a)=b^{-1} a$, for all $a \in A$, then $f$ is a 1-1 map and so $\left|b^{-1} A\right| \geq|A|>\frac{3}{4}|G|$. Now using inclusion-exclusion principle we have

$$

\left|A \cap\left(b^{-1} A\right)\right|=|A|+\left|b^{-1} A\right|-\left|A \cup\left(b^{-1} A\right)\right|>\frac{3}{4}|G|+\frac{3}{4}|G|-|G|=\frac{1}{2}|G|

$$

2. Argue that $A \cap\left(b^{-1} A\right) \subseteq C(b)$, where $C(b)$ is the centralizer of $b$ in $G$.

Suppose $x \in A \cap\left(b^{-1} A\right)$, that means, $x \in A$ and $x \in b^{-1} A$. Thus there exist an element $a \in A$ such that $x=$ $b^{-1} a$, which gives us $x b=a \in A$. Now notice that $x, b \in A$ and $x b \in A$, therefore we get

$$

\phi(x b)=(x b)^{-1} \Longrightarrow \phi(x) \phi(b)=(x b)^{-1} \Longrightarrow x^{-1} b^{-1}=b^{-1} x^{-1} \Longrightarrow x b=b x

$$

Therefore, we get $x b=b x$, for any $x \in A \cap\left(b^{-1} A\right)$, that means, $x \in C(b)$.

3. Argue that $C(b)=G$.

We know that centralizer of an element in a group $G$ is a subgroup (See Page 53). Therefore $C(b)$ is a subgroup of $G$. From statements $\mathbf{1}$ and $\mathbf{2}$, we have

$$

|C(b)| \geq\left|A \cap\left(b^{-1} A\right)\right|>\frac{|G|}{2}

$$

We need to use the following remark to argue $C(b)=G$ from the above step.

Remark. Let $G$ be a finite group and $H$ be a subgroup with more then $|G| / 2$ elements then $H=G$.

Proof of Remark. Suppose $|H|=p$ Then by Lagrange Theorem, there exist an $n \in \mathbb{N}$, such that $|G|=n p$, as $|H|$ divide $|G|$. Now by hypothesis $p>\frac{G]}{2}$ gives us,

$$

p>\frac{|G|}{2} \Longrightarrow n p>\frac{n|G|}{2} \Longrightarrow n<2 \Longrightarrow n=1

$$

Therefore we get $H=G$.

Now notice that $C(b)$ is a subgroup of $G$ with $C(b)$ having more than $|G| / 2$ elements. Therefore, $C(b)=G$.

4. Show that $A \in Z(G)$.

We know that $x \in Z(G)$ if and only if $C(a)=G$. Now notice that, for any $b \in A$ we have $C(b)=G$. Therefore, every element of $A$ is in the center of $G$, that means, $A \subseteq Z(G)$.

5. 5how that $Z(G)=G$.

As it is given that $|A|>\frac{3|G|}{4}$ and $A \leq|Z(G)|$, therefore we get

$$

|Z(G)|>\frac{3}{4}|G|>\frac{1}{2}|G| .

$$

As $Z(G)$ is a subgroup of $G$, so by the above Remark we have $Z(G)=G$. Hence $G$ is abelian.

6. Finally show that $A=G$.

First notice that $A$ is a subgroup of $G$. To show this let $p, q \in A$. Then we have

$$

\phi(p q)=\phi(p) \phi(q)=p^{-1} q^{-1}=(q p)^{-1}=(p q)^{-1}, \quad \text { As } G \text { is abelian. }

$$

Therefore, $p q \in A$ and so we have $A$ is a subgroup of $G$. Again by applying the above remark. we get $A=G$. Therefore we have

$$

\phi(y)=y^{-1}, \quad \text { for all } y \in G

$$

\end{proof}


theorem exercise_2_7_7 {G : Type*} [group G] {G' : Type*} [group G']
  (φ : G →* G') (N : subgroup G) [N.normal] :
  (map φ N).normal  :=

If $\varphi$ is a homomorphism of $G$ onto $G'$ and $N \triangleleft G$, show that $\varphi(N) \triangleleft G'$.

\begin{proof}

We first claim that $\varphi(N)$ is a subgroup of $G'$. To see this, note that since $N$ is a subgroup of $G$, the identity element $e_G$ of $G$ belongs to $N$. Therefore, the element $\varphi(e_G) \in \varphi(N)$, so $\varphi(N)$ is a non-empty subset of $G'$.

Now, let $a', b' \in \varphi(N)$. Then there exist elements $a, b \in N$ such that $\varphi(a) = a'$ and $\varphi(b) = b'$. Since $N$ is a subgroup of $G$, we have $a, b \in N$, so $ab^{-1} \in N$. Thus, we have

$$\varphi(ab^{-1}) = \varphi(a) \varphi(b^{-1}) = a'b'^{-1} \in \varphi(N),$$

which shows that $a', b' \in \varphi(N)$ implies $a'b'^{-1} \in \varphi(N)$. Therefore, $\varphi(N)$ is a subgroup of $G'$.

Next, we will show that $\varphi(N)$ is a normal subgroup of $G'$. Let $\varphi(N) = N'$, a subgroup of $G'$. Let $x' \in G'$ and $h' \in N'$. Since $\varphi$ is onto, there exist elements $x \in G$ and $h \in N$ such that $\varphi(x) = x'$ and $\varphi(h) = h'$.

Since $N$ is a normal subgroup of $G$, we have $xhx^{-1} \in N$. Thus,

$$\varphi(xhx^{-1}) = \varphi(x)\varphi(h)\varphi(x^{-1}) = x'h'x'^{-1} \in \varphi(N),$$

which shows that $x' \in G'$ and $h' \in N'$ implies $x'h'x'^{-1} \in \varphi(N)$. Therefore, $\varphi(N)$ is a normal subgroup of $G'$. This completes the proof.

\end{proof}


theorem exercise_2_8_15 {G H: Type*} [fintype G] [group G] [fintype H]
  [group H] {p q : ℕ} (hp : nat.prime p) (hq : nat.prime q)
  (h : p > q) (h1 : q ∣ p - 1) (hG : card G = p*q) (hH : card G = p*q) :
  G ≃* H :=

Prove that if $p > q$ are two primes such that $q \mid p - 1$, then any two nonabelian groups of order $pq$ are isomorphic.

\begin{proof}

    For a nonabelian group of order $p q$, the structure of the group $G$ is set by determining the relation $a b a^{-1}=b^{k^{\frac{p-1}{q}}}$ for some generator $k$ of the cyclic group. Here we are using the fact that $k^{\frac{p-1}{q}}$ is a generator for the unique subgroup of order $q$ in $U_p$ (a cyclic group of order $m$ has a unique subgroup of order $d$ for each divisor $d$ of $m$ ). The other possible generators of this subgroup are $k^{\frac{l(p-1)}{q}}$ for each $1 \leq l \leq q-1$, so these give potentially new group structures. Let $G^{\prime}$ be a group with an element $c$ of order $q$, an element $d$ of order $p$ with structure defined by the relation $c d c^{-1}=d^{k^{\frac{l(p-1)}{q}}}$. We may then define

$$

\begin{aligned}

\phi: G^{\prime} & \rightarrow G \\

c & \mapsto a^l \\

d & \mapsto b

\end{aligned}

$$

since $c$ and $a^l$ have the same order and $b$ and $d$ have the same order this is a well defined function.

Since

$$

\begin{aligned}

\phi(c) \phi(d) \phi(c)^{-1} & =a^l b a^{-l} \\

& =b^{\left(k^{\frac{p-1}{q}}\right)^l} \\

& =b^{k^{\frac{l(p-1)}{q}}} \\

& =\phi(d)^{k^{\frac{l(p-1)}{q}}}

\end{aligned}

$$

$\phi\left(c^i d^j\right)=a^{l i} b^j=e$ only if $i=j=0$, so $\phi$ is 1-to-l. Therefore $G$ and $G^{\prime}$ are isomorphic and so up to isomorphism there is only one nonabelian group of order $p q$.

\end{proof}


theorem exercise_2_10_1 {G : Type*} [group G] (A : subgroup G)
  [A.normal] {b : G} (hp : nat.prime (order_of b)) :
  A ⊓ (closure {b}) = ⊥ :=

Let $A$ be a normal subgroup of a group $G$, and suppose that $b \in G$ is an element of prime order $p$, and that $b \not\in A$. Show that $A \cap (b) = (e)$.

\begin{proof}

If $b \in G$ has order $p$, then $(b)$ is a cyclic group of order $p$. Since $A$ is a subgroup of $G$, we have $A \cap (b)$ is a subgroup of $G$. Also, $A \cap (b) \subseteq (b)$. So $A \cap (b)$ is a subgroup of $(b)$. Since $(b)$ is a cyclic group of order $p$, the only subgroups of $(b)$ are $(e)$ and $(b)$ itself.

Therefore, either $A \cap (b) = (e)$ or $A \cap (b) = (b)$. If $A \cap (b) = (e)$, then we are done. Otherwise, if $A \cap (b) = (b)$, then $A \subseteq (b)$. Since $A$ is a subgroup of $G$ and $A \subseteq (b)$, it follows that $A$ is a subgroup of $(b)$.

Since the only subgroups of $(b)$ are $(e)$ and $(b)$ itself, we have either $A = (e)$ or $A = (b)$. If $A = (e)$, then $A \cap (b) = (e)$ and we are done. But if $A = (b)$, then $b \in A$ as $b \in (b)$, which contradicts our hypothesis that $b \notin A$. So $A \neq (b)$.

Hence $A \cap (b) \neq (b)$. Therefore, $A \cap (b) = (e)$. This completes our proof.

\end{proof}


theorem exercise_2_11_7 {G : Type*} [group G] {p : ℕ} (hp : nat.prime p)
  {P : sylow p G} (hP : P.normal) :
  characteristic (P : subgroup G) :=

If $P \triangleleft G$, $P$ a $p$-Sylow subgroup of $G$, prove that $\varphi(P) = P$ for every automorphism $\varphi$ of $G$.

\begin{proof}

    Let $\phi$ be an automorphism of $G$. Let $P$ be a normal sylow p-subgroup. $\phi(P)$ is also a sylow-p subgroup. But since $P$ is normal, it is unique. Hence $\phi(P)=P$.

\end{proof}


theorem exercise_3_2_21 {α : Type*} [fintype α] {σ τ: equiv.perm α}
  (h1 : ∀ a : α, σ a = a ↔ τ a ≠ a) (h2 : τ ∘ σ = id) :
  σ = 1 ∧ τ = 1 :=

If $\sigma, \tau$ are two permutations that disturb no common element and $\sigma \tau = e$, prove that $\sigma = \tau = e$.

\begin{proof}

    Note that $\sigma \tau=e$ can equivalentnly be phrased as $\tau$ being the inverse of $\sigma$. Our statement is then equivalent to the statement that an inverse of a nonidentity permutation disturbs at least one same element as that permutation. To prove this, let $\sigma$ be a nonidentity permutation, then let $\left(i_1 \cdots i_n\right)$ be a cycle in $\sigma$. Then we have that

$$

\sigma\left(i_1\right)=i_2, \sigma\left(i_2\right)=i_2, \ldots, \sigma\left(i_{n-1}\right)=i_n, \sigma\left(i_n\right)=i_1,

$$

but then also

$$

i_1=\tau\left(i_2\right), i_2=\tau\left(i_3\right), \ldots, i_{n-1}=\tau\left(i_n\right), i_n=\tau\left(i_1\right),

$$

i.e. its inverse disturbs $i_1, \ldots, i_n$.

\end{proof}


theorem exercise_4_1_34 : equiv.perm (fin 3) ≃* general_linear_group (fin 2) (zmod 2) :=

Let $T$ be the group of $2\times 2$ matrices $A$ with entries in the field $\mathbb{Z}_2$ such that $\det A$ is not equal to 0. Prove that $T$ is isomorphic to $S_3$, the symmetric group of degree 3.

\begin{proof}

    The order of $T$ is $2^4-2^3-2^2+2=6$; we now find those six matrices:

$$

\begin{array}{ll}

A_1=\left(\begin{array}{ll}

1 & 0 \\

0 & 1

\end{array}\right), & A_2=\left(\begin{array}{ll}

0 & 1 \\

1 & 0

\end{array}\right) \\

A_3=\left(\begin{array}{ll}

1 & 0 \\

1 & 1

\end{array}\right), & A_4=\left(\begin{array}{ll}

1 & 1 \\

0 & 1

\end{array}\right) \\

A_5=\left(\begin{array}{ll}

0 & 1 \\

1 & 1

\end{array}\right), & A_6=\left(\begin{array}{ll}

1 & 1 \\

1 & 0

\end{array}\right)

\end{array}

$$

with orders $1,2,2,2,3,3$ respectively.

Note that $S_3$ is composed of elements

$$

\text{ id, (1 2), (1 3), (2 3), (1 2 3), (1 3 2)}

$$

with orders 1, 2, 2, 2, 3, 3 respectively. Also note that, by Problem 17 of generate $S_3$. We also have that $\left(\begin{array}{llll}1 & 3 & 2\end{array}\right)=\left(\begin{array}{llll}1 & 2 & 3\end{array}\right)\left(\begin{array}{lll}1 & 2 & 3\end{array}\right)$, that $\left(\begin{array}{lll}1 & 3\end{array}\right)=\left(\begin{array}{lll}1 & 2 & 3\end{array}\right)\left(\begin{array}{ll}1 & 2\end{array}\right)$, $\left(\begin{array}{ll}1 & 2\end{array}\right)\left(\begin{array}{lll}1 & 2 & 3\end{array}\right)=\left(\begin{array}{ll}2 & 3\end{array}\right)$ and $\left(\begin{array}{lll}1 & 2\end{array}\right)\left(\begin{array}{ll}1 & 2\end{array}\right)=\mathrm{id}$

Now we can check that $\tau\left(A_2\right)=\left(\begin{array}{ll}1 & 2\end{array}\right), \tau\left(A_5\right)=\left(\begin{array}{lll}1 & 2 & 3\end{array}\right)$ induces an isomorphism. We compute

$$

\begin{aligned}

& \tau\left(A_1\right)=\tau\left(A_2 A_2\right)=\tau\left(A_2\right) \tau\left(A_2\right)=\mathrm{id} \\

& \tau\left(A_3\right)=\tau\left(A_5 A_2\right)=\tau\left(A_5\right) \tau\left(A_2\right)=\left(\begin{array}{llll}

1 & 2 & 3

\end{array}\right)\left(\begin{array}{lll}

1 & 2

\end{array}\right)=\left(\begin{array}{ll}

1 & 3

\end{array}\right) \\

& \tau\left(A_4\right)=\tau\left(A_2 A_5\right)=\tau\left(A_2\right) \tau\left(A_5\right)=\left(\begin{array}{lll}

1 & 2

\end{array}\right)\left(\begin{array}{lll}

1 & 2 & 3

\end{array}\right)=\left(\begin{array}{ll}

2 & 3

\end{array}\right) \\

& \tau\left(A_6\right)=\tau\left(A_5 A_5\right)=\tau\left(A_5\right) \tau\left(A_5\right)=\left(\begin{array}{lll}

1 & 3 & 2

\end{array}\right)

\end{aligned}

$$

Thus we see that $\tau$ extendeds to an isomorphism, since $A_2$ and $A_5$ generate $T$, so that $\tau\left(A_i A_j\right)=\tau\left(A_i\right) \tau\left(A_j\right)$ follows from writing $A_i$ and $A_j$ in terms of $A_2$ and $A_5$ and using the equlities and relations shown above.

\end{proof}


theorem exercise_4_2_6 {R : Type*} [ring R] (a x : R)
  (h : a ^ 2 = 0) : a * (a * x + x * a) = (x + x * a) * a :=

If $a^2 = 0$ in $R$, show that $ax + xa$ commutes with $a$.

\begin{proof}

We need to show that

$$

a(a x+x a)=(a x+x a) a \text { for } a, x \in R .

$$

Now,

$$

\begin{gathered}

a(a x+x a)=a(a x)+a(x a) \\

=a^2 x+a x a \\

=0+a x a=a x a .

\end{gathered}

$$

Again,

$$

\begin{gathered}

(a x+x a) a=(a x) a+(x a) a \\

=a x a+x a^2 \\

=a x a+0=a x a .

\end{gathered}

$$

It follows that,

$$

a(a x+x a)=(a x+x a) a, \text { for } x, a \in R .

$$

This shows that $a x+x a$ commutes with $a$. This completes the proof.

\end{proof}


theorem exercise_4_3_1 {R : Type*} [comm_ring R] (a : R) :
  ∃ I : ideal R, {x : R | x*a=0} = I :=

If $R$ is a commutative ring and $a \in R$, let $L(a) = \{x \in R \mid xa = 0\}$. Prove that $L(a)$ is an ideal of $R$.

\begin{proof}

    First, note that if $x \in L(a)$ and $y \in L(a)$ then $x a=0$ and $y a=0$, so that

$$

\begin{aligned}

x a-y a & =0 \\

(x-y) a & =0,

\end{aligned}

$$

i.e. $L(a)$ is an additive subgroup of $R$. (We have used the criterion that $H$ is a subgroup of $G$ if for any $h_1, h_2 \in H$ we have that $h_1 h_2^{-1} \in H$.

Now we prove the conclusion. Let $r \in R$ and $b \in L(a)$, then $b a=0$, and so $x b a=0$ which by associativity of multiplication in $R$ is equivalent to

$$

(x b) a=0,

$$

so that $x b \in L(a)$. Since $R$ is commutative, (1) implies that $(bx)a=0$, so that $b x \in L(a)$, which concludes the proof that $L(a)$ is an ideal.

\end{proof}


theorem exercise_4_4_9 (p : ℕ) (hp : nat.prime p) :
  ∃ S : finset (zmod p), S.card = (p-1)/2 ∧ ∃ x : zmod p, x^2 = p ∧
  ∃ S : finset (zmod p), S.card = (p-1)/2 ∧ ¬ ∃ x : zmod p, x^2 = p :=

Show that $(p - 1)/2$ of the numbers $1, 2, \ldots, p - 1$ are quadratic residues and $(p - 1)/2$ are quadratic nonresidues $\mod p$.

\begin{proof}

    To find all the quadratic residues $\bmod p$ among the integers $1,2, \ldots, p-1$, we compute the least positive residues modulo $p$ of the squares of the integers $1,2, \ldots, p-1\}$.

Since there are $p-1$ squares to consider, and since each congruence $x^2 \equiv a (\bmod p)$ has either zero or two solutions, there must be exactly $\frac{(p-1)}{2}$ quadratic residues mod $p$ among the integers $1,2, \ldots, p-1$.

The remaining

$$

(p-1)-\frac{(p-1)}{2}=\frac{(p-1)}{2}

$$

positive integers less than $p-1$ are quadratic non-residues of $\bmod p$.

\end{proof}


theorem exercise_4_5_23 {p q: polynomial (zmod 7)}
  (hp : p = X^3 - 2) (hq : q = X^3 + 2) :
  irreducible p ∧ irreducible q ∧
  (nonempty $ polynomial (zmod 7) ⧸ ideal.span ({p} : set $ polynomial $ zmod 7) ≃+*
  polynomial (zmod 7) ⧸ ideal.span ({q} : set $ polynomial $ zmod 7)) :=

Let $F = \mathbb{Z}_7$ and let $p(x) = x^3 - 2$ and $q(x) = x^3 + 2$ be in $F[x]$. Show that $p(x)$ and $q(x)$ are irreducible in $F[x]$ and that the fields $F[x]/(p(x))$ and $F[x]/(q(x))$ are isomorphic.

\begin{proof}

    We have that $p(x)$ and $q(x)$ are irreducible if they have no roots in $\mathbb{Z}_7$, which can easily be checked. E.g. for $p(x)$ we have that $p(0)=5, p(1)=6, p(2)=6, p(3)=4, p(4)=6$, $p(5)=4, p(6)=4$, and similarly for $q(x)$.

We have that every element of $F[x] /(p(x))$ is equal to $a x^2+b x+c+(p(x))$, and likewise for $F[x] /(q(x))$. We consider a map $\tau$ : $F[x] /(p(x)) \rightarrow F[x] /(q(x))$ given by

$$

\tau\left(a x^2+b x+c+(p(x))\right)=a x^2-b x+c+(q(x)) .

$$

This map is obviously onto, and since $|F[x] /(p(x))|=|F[x] /(q(x))|=7^3$ by Problem 16, it is also one-to-one. We claim that it is a homomorphism. Additivity of $\tau$ is immediate by the linearity of addition of polynomial coefficient, so we just have to check the multiplicativity; if $n=a x^2+b x+$ $c+(p(x))$ and $m=d x^2+e x+f+(p(x))$ then

$$

\begin{aligned}

\tau(n m) & =\tau\left(a d x^4+(a e+b d) x^3+(a f+b e+c d) x^2+(b f+c e) x+c f+(p(x))\right) \\

& =\tau\left(2 a d x+2(a e+b d)+(a f+b e+c d) x^2+(b f+c e) x+c f+(p(x))\right) \\

& =\tau\left((a f+b e+c d) x^2+(b f+c e+2 a d) x+(c f+2 a e+2 b d)+(p(x))\right) \\

& =(a f+b e+c d) x^2-(b f+c e+2 a d) x+c f+2 a e+2 b d+(q(x)) \\

& =a d x^4-(a e+b d) x^3+(a f+b e+c d) x^2-(b f+c e) x+c f+(q(x)) \\

& =\left(a x^2-b x+c+(q(x))\right)\left(d x^2-e x+f+(q(x))\right) \\

& =\tau(n) \tau(m) .

\end{aligned}

$$

where in the second equality we used that $x^3+p(x)=2+p(x)$ and in the fifth we used that $x^3+$ $q(x)=-2+q(x)$

\end{proof}


theorem exercise_4_6_2 : irreducible (X^3 + 3*X + 2 : polynomial ℚ) :=

Prove that $f(x) = x^3 + 3x + 2$ is irreducible in $Q[x]$.

\begin{proof}

Let us assume that $f(x)$ is reducible over $\mathbb{Q}[x]$.

Then there exists a rational root of $f(x)$.

Let $p / q$ be a rational root of $f(x)$, where $\operatorname{gcd}(p, q)=1$.

Then $f(p / q)=0$.

Now,

$$

\begin{aligned}

& f(p / q)=(p / q)^3+3(p / q)+2 \\

\Longrightarrow & (p / q)^3+3(p / q)+2=0 \\

\Longrightarrow & p^3+3 p q^2=-2 q^3 \\

\Longrightarrow & p\left(p^2+3 q^2\right)=-q^3

\end{aligned}

$$

It follows that, $p$ divides $q$ which is a contradiction to the fact that $\operatorname{gcd}(p, q)=1$.

This implies that $f(x)$ has no rational root.

Now we know that, a polynomial of degree two or three over a field $F$ is reducible if and only if it has a root in $F$.

Now $f(x)$ is a 3 degree polynomial having no root in $\mathbb{Q}$.

So, $f(x)$ is irreducible in $\mathbb{Q}[x]$.

This completes the proof.

\end{proof}


theorem exercise_5_1_8 {p m n: ℕ} {F : Type*} [field F]
  (hp : nat.prime p) (hF : char_p F p) (a b : F) (hm : m = p ^ n) :
  (a + b) ^ m = a^m + b^m :=

If $F$ is a field of characteristic $p \neq 0$, show that $(a + b)^m = a^m + b^m$, where $m = p^n$, for all $a, b \in F$ and any positive integer $n$.

\begin{proof}

    Since $F$ is of characteristic $p$ and we have considered arbitrary two elements $a, b$ in $F$ we have

$$

\begin{aligned}

& p a=p b=0 \\

& \Longrightarrow p^n a=p^n b=0 \\

& \Longrightarrow m a=m b=0 \text {. } \\

&

\end{aligned}

$$

Now we know from Binomial Theorem that

$$

(a+b)^m=\sum_{i=0}^m\left(\begin{array}{c}

m \\

i

\end{array}\right) a^i b^{m-i}

$$

Here

$$

\left(\begin{array}{c}

m \\

i

\end{array}\right)=\frac{m !}{i !(m-i) !} .

$$

Now we know that for any integer $n$ and any integer $k$ satisfying $1 \leq k<n, n$ always divides $\left(\begin{array}{l}n \\ k\end{array}\right)$. So in our case for $i$ in the range $1 \leq i<m, m$ divides $\left(\begin{array}{c}m \\ i\end{array}\right)$. It follows that $p$ divides $\left(\begin{array}{c}m \\ i\end{array}\right)$, for $i$ satisfying $1 \leq i<m$, since $m=p^n$ for any integer $n$. Therefore other than the terms $a^m$ and $b^m$ in the expansion $\sum_{i=0}^m\left(\begin{array}{c}m \\ i\end{array}\right) a^i b^{m-i}$ will vanish due to char $p$ nature of $F$.

Hence we have

$$

\sum_{i=0}^m\left(\begin{array}{c}

m \\

i

\end{array}\right) a^i b^{m-i}=a^m+b^m

$$

This follows that, for all $a, b \in F$

$$

(a+b)^m=a^m+b^m .

$$

This completes the proof.

\end{proof}


theorem exercise_5_3_7 {K : Type*} [field K] {F : subfield K}
  {a : K} (ha : is_algebraic F (a ^ 2)) : is_algebraic F a :=

If $a \in K$ is such that $a^2$ is algebraic over the subfield $F$ of $K$, show that a is algebraic over $F$.

\begin{proof}

    Since $a^2$ is algebraic over $F$, there exist a non-zero polynomial $f(x)$ in $F[x]$ such that $f\left(a^2\right)=0$. Consider a new polynomial $g(x)$ defined as $g(x)=f\left(x^2\right)$. Clearly $g(x) \in F[x]$ and $g(a)=f\left(a^2\right)= 0$.

\end{proof}


theorem exercise_5_4_3 {a : ℂ} {p : ℂ → ℂ}
  (hp : p = λ x, x^5 + real.sqrt 2 * x^3 + real.sqrt 5 * x^2 +
  real.sqrt 7 * x + 11)
  (ha : p a = 0) :
  ∃ p : polynomial ℂ , p.degree < 80 ∧ a ∈ p.roots ∧
  ∀ n : p.support, ∃ a b : ℤ, p.coeff n = a / b :=

If $a \in C$ is such that $p(a) = 0$, where $p(x) = x^5 + \sqrt{2}x^3 + \sqrt{5}x^2 + \sqrt{7}x + \sqrt{11}$, show that $a$ is algebraic over $\mathbb{Q}$ of degree at most 80.

\begin{proof}

    Given $a \in \mathbb{C}$ such that $p(a)=0$, where

$$

p(x)=x^5+\sqrt{2} x^3+\sqrt{5} x^2+\sqrt{7} x+\sqrt{11}

$$

Here, we note that $p(x) \in \mathbb{Q}(\sqrt{2}, \sqrt{5}, \sqrt{7}, \sqrt{11})$ and

$$

\begin{aligned}

    {[Q(\sqrt{2}, \sqrt{5}, \sqrt{7}, \sqrt{11}): \mathbb{Q}] } & =[Q(\sqrt{2}, \sqrt{5}, \sqrt{7}, \sqrt{11}): Q(\sqrt{2}, \sqrt{5}, \sqrt{7})] \cdot[\mathbb{Q}(\sqrt{2}, \sqrt{5}, \sqrt{7}): \mathbb{Q}(\sqrt{2}, \sqrt{5})] \\

& \cdot[\mathbb{Q}(\sqrt{2}, \sqrt{5}): \mathbb{Q}(\sqrt{2})] \cdot[\mathbb{Q}(\sqrt{2}): \mathbb{Q}] \\

& =2 \cdot 2 \cdot 2 \cdot 2 \\

& =16

\end{aligned}

$$

Here, we note that $p(x)$ is of degree 5 over $\mathbb{Q}(\sqrt{2}, \sqrt{5}, \sqrt{7}, \sqrt{11})$. If $a$ is root of $p(x)$, then

$$

[Q(\sqrt{2}, \sqrt{5}, \sqrt{7}, \sqrt{11}, a): \mathbb{Q}]=[Q(\sqrt{2}, \sqrt{5}, \sqrt{7}, \sqrt{11}): Q(\sqrt{2}, \sqrt{5}, \sqrt{7}, \sqrt{11})] \cdot 15

$$

and $[Q(\sqrt{2}, \sqrt{5}, \sqrt{7}, \sqrt{11}): Q(\sqrt{2}, \sqrt{5}, \sqrt{7}, \sqrt{11})] \leq 5$. We get equality if $p(x)$ is irreducible over $Q(\sqrt{2}, \sqrt{5}, \sqrt{7}, \sqrt{11})$. This gives

$$

[Q(\sqrt{2}, \sqrt{5}, \sqrt{7}, \sqrt{11}, a): \mathbb{Q}] \leq 16 \cdot 5=80

$$

\end{proof}


theorem exercise_5_6_14 {p m n: ℕ} (hp : nat.prime p) {F : Type*}
  [field F] [char_p F p] (hm : m = p ^ n) :
  card (root_set (X ^ m - X : polynomial F) F) = m :=

If $F$ is of characteristic $p \neq 0$, show that all the roots of $x^m - x$, where $m = p^n$, are distinct.

\begin{proof}

    Let us consider $f(x)=x^m-x$. Then $f \in F[x]$.

Claim: $f(x)$ has a multiple root in some extension of $F$ if and only if $f(x)$ is not relatively prime to its formal derivative, $f^{\prime}(x)$.

Proof of the Claim: Let us assume that $f(x)$ has a multiple root in some extension of $F$. Let $y$ be a multiple root of $f(x)$. Then over a splitting field, we have

$$

f(x)=(x-y)^n g(x), \text { for some integer } n \geq 2 .

$$

Here $g(x)$ is a polynomial such that $g(y) \neq 0$. Now taking derivative of $f$ we get

$$

f^{\prime}(x)=n \cdot(x-y)^{n-1} g(x)+(x-y)^n g^{\prime}(x)

$$

here $g^{\prime}(x)$ implies derivative of $g$ with respect to $x$. Since we have $n \geq 2$, this implies $(n-1) \geq 1$. Hence, (1) shows that $f^{\prime}(x)$ has $y$ as a root. Therefore, $f(x)$ is not relatively prime to $f^{\prime}(x)$. We now prove the other direction.

Conversely, let us assume that $f(x)$ is not relatively prime to $f^{\prime}(x)$. Let $y$ is a root of both $f(x)$ and $f^{\prime}(x)$. Since $y$ is a root of $f(x)$, we can write

$$

f(x)=(x-y) \cdot g(x)

$$

for some polynomial $g(x)$. then taking derivative of $f(x)$ we have

$$

f^{\prime}(x)=g(x)+(x-y) \cdot g^{\prime}(x)

$$

where $g^{\prime}(x)$ is the derivative of $g(x)$ with respect to $x$. Since $y$ is a root of $f^{\prime}(x)$ also we have

$$

f^{\prime}(y)=0

$$

Then we have

$$

\begin{aligned}

& f^{\prime}(y)=g(y)+(y-y) \cdot g^{\prime}(y) \\

\Longrightarrow & f^{\prime}(y)=g(y) \\

\Longrightarrow & g(y)=0 .

\end{aligned}

$$

This implies $y$ is a root of $g(x)$ also. Therefore we have

$$

g(x)=(x-y) \cdot h(x)

$$

for some polynomial $h(x)$. Now form (2) we have

$$

f(x)=(x-y)^2 \cdot h(x) .

$$

This follows that $y$ is a multiple root of $f(x)$. Therefore, $f(x)$ has a multiple root in some extension of the field $F$. This completes the proof of the Claim.

In our case, $f(x)=x^m-x$, where $m=p^n$. Now we calculate the derivative of $f$. That is

$$

f^{\prime}(x)=m x^{m-1}-1=-1(\bmod p) .

$$

By the above condition it follows that, $f^{\prime}$ has no root same as $f$, that is, $f(x)$ and $f^{\prime}(x)$ are relatively prime. Hence, $f(x)$ has no multiple root in $F$. Since $f(x)=x^m-x$ is a polynomial of degree $m$, it follows that $f(x)$ has $m$ distinct roots in $F$, where $m=p^n$. This completes the proof.

\end{proof}


theorem exercise_2_3_2 {G : Type*} [group G] (a b : G) :
  ∃ g : G, b* a = g * a * b * g⁻¹ :=

import .common

open function fintype subgroup ideal polynomial submodule zsqrtd char_p
open_locale big_operators
noncomputable theory

Prove that the products $a b$ and $b a$ are conjugate elements in a group.

\begin{proof}

    We have that $(a^{-1})ab(a^{-1})^{-1} = ba$.

\end{proof}


theorem exercise_2_8_6 {G H : Type*} [group G] [group H] :
  center (G × H) ≃* (center G) × (center H) :=

Prove that the center of the product of two groups is the product of their centers.

\begin{proof}

    We have that $(g_1, g_2)\cdot (h_1, h_2) = (h_1, h_2)\cdot (g_1, g_2)$ if and only if $g_1h_1 = h_1g_1$ and $g_2h_2 = h_2g_2$.

\end{proof}


theorem exercise_3_2_7 {F : Type*} [field F] {G : Type*} [field G]
  (φ : F →+* G) : injective φ :=

Prove that every homomorphism of fields is injective.

\begin{proof}

    Suppose $f(a)=f(b)$, then $f(a-b)=0=f(0)$. If $u=(a-b) \neq 0$, then $f(u) f\left(u^{-1}\right)=f(1)=1$, but that means that $0 f\left(u^{-1}\right)=1$, which is impossible. Hence $a-b=0$ and $a=b$.

\end{proof}


theorem exercise_3_7_2 {K V : Type*} [field K] [add_comm_group V]
  [module K V] {ι : Type*} [fintype ι] (γ : ι → submodule K V) :
  (⋂ (i : ι), (γ i : set V)) ≠ ⊤ :=

Let $V$ be a vector space over an infinite field $F$. Prove that $V$ is not the union of finitely many proper subspaces.

\begin{proof}

    If $V$ is the set-theoretic union of $n$ proper subspaces $W_i$ ( $1 \leq i \leq n$ ), then $|F| \leq n-1$.

Proof. We may suppose no $W_i$ is contained in the union of the other subspaces. Let $u \in W_i, \quad u \notin \bigcup_{j \neq i} W_j$ and $v \notin W_i$.

Then $(v+F u) \cap W_i=\varnothing$ and $(v+F u) \cap W_j(j \neq i)$ contains at most one vector since otherwise $W_j$ would contain $u$. Hence

$$

|v+F u|=|F| \leq n-1 .

$$

Corollary: Avoidance lemma for vector spaces.

Let $E$ be a vector space over an infinite field. If a subspace is contained in a finite union of subspaces, it is contained in one of them.

\end{proof}


theorem exercise_6_4_2 {G : Type*} [group G] [fintype G] {p q : ℕ}
  (hp : prime p) (hq : prime q) (hG : card G = p*q) :
  is_simple_group G → false :=

Prove that no group of order $p q$, where $p$ and $q$ are prime, is simple.

\begin{proof}

    If $|G|=n=p q$ then the only two Sylow subgroups are of order $p$ and $q$.

From Sylow's third theorem we know that $n_p \mid q$ which means that $n_p=1$ or $n_p=q$.

If $n_p=1$ then we are done (by a corollary of Sylow's theorem)

If $n_p=q$ then we have accounted for $q(p-1)=p q-q$ elements of $G$ and so there is only one group of order $q$ and again we are done.

\end{proof}


theorem exercise_6_4_12 {G : Type*} [group G] [fintype G]
  (hG : card G = 224) :
  is_simple_group G → false :=

Prove that no group of order 224 is simple.

\begin{proof}

    The following proves there must exist a normal Sylow 2 -subgroup of order 32 ,

Suppose there are $n_2=7$ Sylow 2 -subgroups in $G$. Making $G$ act on the set of these Sylow subgroups by conjugation (Mitt wrote about this but on the set of the other Sylow subgroups, which gives no contradiction), we get a homomorphism $G \rightarrow S_7$ which must be injective if $G$ is simple (why?).

But this cannot be since then we would embed $G$ into $S_7$, which is impossible since $|G| \nmid 7 !=\left|S_7\right|$ (why?)

\end{proof}


theorem exercise_10_1_13 {R : Type*} [ring R] {x : R}
  (hx : is_nilpotent x) : is_unit (1 + x) :=

An element $x$ of a ring $R$ is called nilpotent if some power of $x$ is zero. Prove that if $x$ is nilpotent, then $1+x$ is a unit in $R$.


theorem exercise_10_6_7 {I : ideal gaussian_int}
  (hI : I ≠ ⊥) : ∃ (z : I), z ≠ 0 ∧ (z : gaussian_int).im = 0 :=

Prove that every nonzero ideal in the ring of Gauss integers contains a nonzero integer.

\begin{proof}

    Let $I$ be some nonzero ideal. Then there exists some $z \in \mathbb{Z}[i], z \neq 0$ such that $z \in I$. We know that $z=a+b i$, for some $a, b \in \mathbb{Z}$. We consider three cases:

1. If $b=0$, then $z=a$, so $z \in \mathbb{Z} \cap I$, and $z \neq 0$, so the statement of the exercise holds.

2. If $a=0$, then $z=i b$. Since $z \neq 0$, we conclude that $b \neq 0$. Since $I$ is an ideal in $\mathbb{Z}[i]$, and $i \in \mathbb{Z}[i]$, we conclude that $i z \in I$. Furthermore, $i z=-b \in \mathbb{Z}$. Thus, $i z$ is a nonzero integer which is in $I$.

3. Let $a \neq 0$ and $b \neq 0$. Since $I$ is an ideal and $z \in I$, we conclude that $z^2 \in I$; that is,

$$

(a+b i)^2=a^2-b^2+2 a b i \in I

$$

Furthermore, since $-2 a \in \mathbb{Z}[i]$, and $z \in I$ and $I$ is an ideal, $-2 a z \in I$; that is,

$$

-2 a z=-2 a(a+b i)=-2 a^2-2 a b i \in I

$$

Since $I$ is closed under addition,

$$

\left(a^2-b^2+2 a b i\right)+\left(-2 a^2-2 a b i\right) \in I \Longrightarrow-a^2-b^2 \in I

$$

Notice that $-a^2-b^2 \neq 0$ since $a^2>0$ and $b^2>0$, so $-a^2-b^2<0$. Furthermore, it is an integer. Thus, we have found a nonzero integer in $I$.

\end{proof}


theorem exercise_10_4_7a {R : Type*} [comm_ring R] [no_zero_divisors R]
  (I J : ideal R) (hIJ : I + J = ⊤) : I * J = I ⊓ J :=

Let $I, J$ be ideals of a ring $R$ such that $I+J=R$. Prove that $I J=I \cap J$.

\begin{proof}

    We have seen that $IJ \subset I \cap J$, so it remains to show that $I \cap J \subset IJ$.  Since $I+J = (1)$, there are elements $i \in I$ and $j \in J$ such that $i+j = 1$.  Let $k \in I \cap J$, and multiply $i+j=1$ through by $k$ to get $ki+kj = k$.  Write this more suggestively as

\[ k = ik+kj. \]

The first term is in $IJ$ because $k \in J$, and the second term is in $IJ$ because $k \in I$, so $k \in IJ$ as desired.

\end{proof}


theorem exercise_11_2_13 (a b : ℤ) :
  (of_int a : gaussian_int) ∣ of_int b → a ∣ b :=

If $a, b$ are integers and if $a$ divides $b$ in the ring of Gauss integers, then $a$ divides $b$ in $\mathbb{Z}$.

\begin{proof}

    Suppose $a|b$ in $\mathbb{Z}[i]$ and $a,b\in\mathbb{Z}$. Then $a(x+yi)=b$ for $x,y\in\mathbb{Z}$. Expanding this we get $ax+ayi=b$, and equating imaginary parts gives us $ay=0$, implying $y=0$.

\end{proof}


theorem exercise_11_4_6a {F : Type*} [field F] [fintype F] (hF : card F = 7) :
  irreducible (X ^ 2 + 1 : polynomial F) :=

Prove that $x^2+x+1$ is irreducible in the field $\mathbb{F}_2$.

\begin{proof}

    If $x^2+x+1$ were reducible in $\mathbb{F}_2$, its factors must be linear. But we neither have that $0^2+0+1=$ nor $1^2+1+1=0$, therefore $x^2+x+1$ is irreducible.

\end{proof}


theorem exercise_11_4_6c : irreducible (X^3 - 9 : polynomial (zmod 31)) :=

Prove that $x^3 - 9$ is irreducible in $\mathbb{F}_{31}$.

\begin{proof}

    If $p(x) = x^3-9$ were reducible, it would have a linear factor, since it either has a linear factor and a quadratic factor or three linear factors. We can then verify by brute force that $p(x)\neq 0$ for $x \in \mathbb{F}_31$.

\end{proof}


theorem exercise_11_13_3 (N : ℕ):
  ∃ p ≥ N, nat.prime p ∧ p + 1 ≡ 0 [MOD 4] :=

Prove that there are infinitely many primes congruent to $-1$ (modulo $4$).

\begin{proof}

    First we show a lemma: if $a \equiv 3(\bmod 4)$ then there exists a prime $p$ such that $p \mid a$ and $p \equiv 3(\bmod 4)$.

    Clearly, all primes dividing $a$ are odd. Suppose all of them would be $\equiv 1(\bmod 4)$. Then their product would also be $a \equiv 1(\bmod 4)$, which is a contradiction.

To prove the main claim, suppose that $p_1, \ldots, p_n$ would be all such primes. (In particular, we have $p_1=3$.) Consider $a=4 p_2 \cdots p_n+3$. (Or you can take $a=4 p_2 \cdots p_n-1$.) Show that $p_i \nmid a$ for $i=1, \ldots, n$. (The case $3 \nmid a$ is solved differently than the other primes - this is the reason for omitting $p_1$ in the definition of $a$.) Then use the above lemma to get a contradiction.

\end{proof}


theorem exercise_13_6_10 {K : Type*} [field K] [fintype Kˣ] :
  ∏ (x : Kˣ), x = -1 :=

Let $K$ be a finite field. Prove that the product of the nonzero elements of $K$ is $-1$.

\begin{proof}

    Since we are working with a finite field with $q$ elements, anyone of them is a root of the following polynomial

$$

x^q-x=0 .

$$

In particular if we rule out the 0 element, any $a_i \neq 0$ is a root of

$$

x^{q-1}-1=0 .

$$

This polynomial splits completely in $\mathbb{F}_q$ so we find

$$

\left(x-a_1\right) \cdots\left(x-a_{q-1}\right)=0

$$

in particular

$$

x^{q-1}-1=\left(x-a_1\right) \cdots\left(x-a_{q-1}\right)

$$

Thus $a_1 \cdots a_{q-1}=-1$.

\end{proof}


theorem exercise_1_1_3 (n : ℤ) :
  ∀ (a b c : ℤ), (a+b)+c ≡ a+(b+c) [ZMOD n] :=

import .common

open set function nat int fintype real polynomial mv_polynomial
open subgroup ideal submodule zsqrtd gaussian_int char_p mul_aut matrix

open_locale pointwise
open_locale big_operators
noncomputable theory

Prove that the addition of residue classes $\mathbb{Z}/n\mathbb{Z}$ is associative.

\begin{proof}

    We have

$$

\begin{aligned}

(\bar{a}+\bar{b})+\bar{c} &=\overline{a+b}+\bar{c} \\

&=\overline{(a+b)+c} \\

&=\overline{a+(b+c)} \\

&=\bar{a}+\overline{b+c} \\

&=\bar{a}+(\bar{b}+\bar{c})

\end{aligned}

$$

since integer addition is associative.

\end{proof}


theorem exercise_1_1_5 (n : ℕ) (hn : 1 < n) :
  is_empty (group (zmod n)) :=

Prove that for all $n>1$ that $\mathbb{Z}/n\mathbb{Z}$ is not a group under multiplication of residue classes.

\begin{proof}

    Note that since $n>1, \overline{1} \neq \overline{0}$. Now suppose $\mathbb{Z} /(n)$ contains a multiplicative identity element $\bar{e}$. Then in particular,

$$

\bar{e} \cdot \overline{1}=\overline{1}

$$

so that $\bar{e}=\overline{1}$. Note, however, that

$$

\overline{0} \cdot \bar{k}=\overline{0}

$$

for all k, so that $\overline{0}$ does not have a multiplicative inverse. Hence $\mathbb{Z} /(n)$ is not a group under multiplication.

\end{proof}


theorem exercise_1_1_16 {G : Type*} [group G]
  (x : G) (hx : x ^ 2 = 1) :
  order_of x = 1 ∨ order_of x = 2 :=

Let $x$ be an element of $G$. Prove that $x^2=1$ if and only if $|x|$ is either $1$ or $2$.

\begin{proof}

    $(\Rightarrow)$ Suppose $x^2=1$. Then we have $0<|x| \leq 2$, i.e., $|x|$ is either 1 or 2 .

( $\Leftarrow$ ) If $|x|=1$, then we have $x=1$ so that $x^2=1$. If $|x|=2$ then $x^2=1$ by definition. So if $|x|$ is 1 or 2 , we have $x^2=1$.

\end{proof}


theorem exercise_1_1_18 {G : Type*} [group G]
  (x y : G) : x * y = y * x ↔ y⁻¹ * x * y = x ↔ x⁻¹ * y⁻¹ * x * y = 1 :=

Let $x$ and $y$ be elements of $G$. Prove that $xy=yx$ if and only if $y^{-1}xy=x$ if and only if $x^{-1}y^{-1}xy=1$.

\begin{proof}

If $x y=y x$, then $y^{-1} x y=y^{-1} y x=1 x=x$. Multiplying by $x^{-1}$ then gives $x^{-1} y^{-1} x y=1$.

On the other hand, if $x^{-1} y^{-1} x y=1$, then we may multiply on the left by $x$ to get $y^{-1} x y=x$. Then multiplying on the left by $y$ gives $x y=y x$ as desired.

\end{proof}


theorem exercise_1_1_22a {G : Type*} [group G] (x g : G) :
  order_of x = order_of (g⁻¹ * x * g) :=

If $x$ and $g$ are elements of the group $G$, prove that $|x|=\left|g^{-1} x g\right|$.

\begin{proof}

    First we prove a technical lemma:

    {\bf Lemma.} For all $a, b \in G$ and $n \in \mathbb{Z},\left(b^{-1} a b\right)^n=b^{-1} a^n b$.

The statement is clear for $n=0$. We prove the case $n>0$ by induction; the base case $n=1$ is clear. Now suppose $\left(b^{-1} a b\right)^n=b^{-1} a^n b$ for some $n \geq 1$; then

$$

\left(b^{-1} a b\right)^{n+1}=\left(b^{-1} a b\right)\left(b^{-1} a b\right)^n=b^{-1} a b b^{-1} a^n b=b^{-1} a^{n+1} b .

$$

By induction the statement holds for all positive $n$.

Now suppose $n<0$; we have

$$

\left(b^{-1} a b\right)^n=\left(\left(b^{-1} a b\right)^{-n}\right)^{-1}=\left(b^{-1} a^{-n} b\right)^{-1}=b^{-1} a^n b .

$$

Hence, the statement holds for all integers $n$.

Now to the main result. Suppose first that $|x|$ is infinity and that $\left|g^{-1} x g\right|=n$ for some positive integer $n$. Then we have

$$

\left(g^{-1} x g\right)^n=g^{-1} x^n g=1,

$$

and multiplying on the left by $g$ and on the right by $g^{-1}$ gives us that $x^n=1$, a contradiction. Thus if $|x|$ is infinity, so is $\left|g^{-1} x g\right|$. Similarly, if $\left|g^{-1} x g\right|$ is infinite and $|x|=n$, we have

$$

\left(g^{-1} x g\right)^n=g^{-1} x^n g=g^{-1} g=1,

$$

a contradiction. Hence if $\left|g^{-1} x g\right|$ is infinite, so is $|x|$.

Suppose now that $|x|=n$ and $\left|g^{-1} x g\right|=m$ for some positive integers $n$ and $m$. We have

$$

\left(g^{-1} x g\right)^n=g^{-1} x^n g=g^{-1} g=1,

$$

So that $m \leq n$, and

$$

\left(g^{-1} x g\right)^m=g^{-1} x^m g=1,

$$

so that $x^m=1$ and $n \leq m$. Thus $n=m$.

\end{proof}


theorem exercise_1_1_25 {G : Type*} [group G]
  (h : ∀ x : G, x ^ 2 = 1) : ∀ a b : G, a*b = b*a :=

Prove that if $x^{2}=1$ for all $x \in G$ then $G$ is abelian.

\begin{proof}

    Solution: Note that since $x^2=1$ for all $x \in G$, we have $x^{-1}=x$. Now let $a, b \in G$. We have

$$

a b=(a b)^{-1}=b^{-1} a^{-1}=b a .

$$

Thus $G$ is abelian.

\end{proof}


theorem exercise_1_1_34 {G : Type*} [group G] {x : G}
  (hx_inf : order_of x = 0) (n m : ℤ) :
  x ^ n ≠ x ^ m :=

If $x$ is an element of infinite order in $G$, prove that the elements $x^{n}, n \in \mathbb{Z}$ are all distinct.

\begin{proof}

    Solution: Suppose to the contrary that $x^a=x^b$ for some $0 \leq a<b \leq n-1$. Then we have $x^{b-a}=1$, with $1 \leq b-a<n$. However, recall that $n$ is by definition the least integer $k$ such that $x^k=1$, so we have a contradiction. Thus all the $x^i$, $0 \leq i \leq n-1$, are distinct. In particular, we have

$$

\left\{x^i \mid 0 \leq i \leq n-1\right\} \subseteq G,

$$

so that $|x|=n \leq|G|$

\end{proof}


theorem exercise_1_6_4 :
  is_empty (multiplicative ℝ ≃* multiplicative ℂ) :=

Prove that the multiplicative groups $\mathbb{R}-\{0\}$ and $\mathbb{C}-\{0\}$ are not isomorphic.

\begin{proof}

    Isomorphic groups necessarily have the same number of elements of order $n$ for all finite $n$.

Now let $x \in \mathbb{R}^{\times}$. If $x=1$ then $|x|=1$, and if $x=-1$ then $|x|=2$. If (with bars denoting absolute value) $|x|<1$, then we have

$$

1>|x|>\left|x^2\right|>\cdots,

$$

and in particular, $1>\left|x^n\right|$ for all $n$. So $x$ has infinite order in $\mathbb{R}^{\times}$.

Similarly, if $|x|>1$ (absolute value) then $x$ has infinite order in $\mathbb{R}^{\times}$. So $\mathbb{R}^{\times}$has 1 element of order 1,1 element of order 2 , and all other elements have infinite order.

In $\mathbb{C}^{\times}$, on the other hand, $i$ has order 4 . Thus $\mathbb{R}^{\times}$and $\mathbb{C}^{\times}$are not isomorphic.

\end{proof}


theorem exercise_1_6_17 {G : Type*} [group G] (f : G → G)
  (hf : f = λ g, g⁻¹) :
  ∀ x y : G, f x * f y = f (x*y) ↔ ∀ x y : G, x*y = y*x :=

Let $G$ be any group. Prove that the map from $G$ to itself defined by $g \mapsto g^{-1}$ is a homomorphism if and only if $G$ is abelian.

\begin{proof}

    $(\Rightarrow)$ Suppose $G$ is abelian. Then

$$

\varphi(a b)=(a b)^{-1}=b^{-1} a^{-1}=a^{-1} b^{-1}=\varphi(a) \varphi(b),

$$

so that $\varphi$ is a homomorphism.

$(\Leftarrow)$ Suppose $\varphi$ is a homomorphism, and let $a, b \in G$. Then

$$

a b=\left(b^{-1} a^{-1}\right)^{-1}=\varphi\left(b^{-1} a^{-1}\right)=\varphi\left(b^{-1}\right) \varphi\left(a^{-1}\right)=\left(b^{-1}\right)^{-1}\left(a^{-1}\right)^{-1}=b a,

$$

so that $G$ is abelian.

\end{proof}


theorem exercise_2_1_5 {G : Type*} [group G] [fintype G]
  (hG : card G > 2) (H : subgroup G) [fintype H] :
  card H ≠ card G - 1 :=

Prove that $G$ cannot have a subgroup $H$ with $|H|=n-1$, where $n=|G|>2$.

\begin{proof}

    Solution: Under these conditions, there exists a nonidentity element $x \in H$ and an element $y \notin H$. Consider the product $x y$. If $x y \in H$, then since $x^{-1} \in H$ and $H$ is a subgroup, $y \in H$, a contradiction. If $x y \notin H$, then we have $x y=y$. Thus $x=1$, a contradiction. Thus no such subgroup exists.

\end{proof}


theorem exercise_2_4_4 {G : Type*} [group G] (H : subgroup G) :
  subgroup.closure ((H : set G) \ {1}) = ⊤ :=

Prove that if $H$ is a subgroup of $G$ then $H$ is generated by the set $H-\{1\}$.

\begin{proof}

    If $H=\{1\}$ then $H-\{1\}$ is the empty set which indeed generates the trivial subgroup $H$. So suppose $|H|>1$ and pick a nonidentity element $h \in H$. Since $1=h h^{-1} \in\langle H-\{1\}\rangle$ (Proposition 9), we see that $H \leq\langle H-\{1\}\rangle$. By minimality of $\langle H-\{1\}\rangle$, the reverse inclusion also holds so that $\langle H-\{1\}\rangle=$ $H$.

\end{proof}


theorem exercise_2_4_16b {n : ℕ} {hn : n ≠ 0}
  {R : subgroup (dihedral_group n)}
  (hR : R = subgroup.closure {dihedral_group.r 1}) :
  R ≠ ⊤ ∧
  ∀ K : subgroup (dihedral_group n), R ≤ K → K = R ∨ K = ⊤ :=

Show that the subgroup of all rotations in a dihedral group is a maximal subgroup.

\begin{proof}

    Fix a positive integer $n>1$ and let $H \leq D_{2 n}$ consist of the rotations of $D_{2 n}$. That is, $H=\langle r\rangle$. Now, this subgroup is proper since it does not contain $s$. If $H$ is not maximal, then by the previous proof we know there is a maximal subset $K$ containing $H$. Then $K$ must contain a reflection $s r^k$ for $k \in\{0,1, \ldots, n-1\}$. Then since $s r^k \in K$ and $r^{n-k} \in K$, it follows by closure that

$$

s=\left(s r^k\right)\left(r^{n-k}\right) \in K .

$$

But $D_{2 n}=\langle r, s\rangle$, so this shows that $K=D_{2 n}$, which is a contradiction. Therefore $H$ must be maximal.

\end{proof}


theorem exercise_3_1_3a {A : Type*} [comm_group A] (B : subgroup A) :
  ∀ a b : A ⧸ B, a*b = b*a :=

Let $A$ be an abelian group and let $B$ be a subgroup of $A$. Prove that $A / B$ is abelian.

\begin{proof}

    Lemma: Let $G$ be a group. If $|G|=2$, then $G \cong Z_2$.

Proof: Since $G=\{e a\}$ has an identity element, say $e$, we know that $e e=e, e a=a$, and $a e=a$. If $a^2=a$, we have $a=e$, a contradiction. Thus $a^2=e$. We can easily see that $G \cong Z_2$.

If $A$ is abelian, every subgroup of $A$ is normal; in particular, $B$ is normal, so $A / B$ is a group. Now let $x B, y B \in A / B$. Then

$$

(x B)(y B)=(x y) B=(y x) B=(y B)(x B) .

$$

Hence $A / B$ is abelian.

\end{proof}


theorem exercise_3_1_22b {G : Type*} [group G] (I : Type*)
  (H : I → subgroup G) (hH : ∀ i : I, subgroup.normal (H i)) :
  subgroup.normal (⨅ (i : I), H i):=

Prove that the intersection of an arbitrary nonempty collection of normal subgroups of a group is a normal subgroup (do not assume the collection is countable).

\begin{proof}

Let $\left\{H_i \mid i \in I\right\}$ be an arbitrary collection of normal subgroups of $G$ and consider the intersection

$$

\bigcap_{i \in I} H_i

$$

Take an element $a$ in the intersection and an arbitrary element $g \in G$. Then $g a g^{-1} \in H_i$ because $H_i$ is normal for any $i \in H$

By the definition of the intersection, this shows that $g a g^{-1} \in \bigcap_{i \in I} H_i$ and therefore it is a normal subgroup.

\end{proof}


theorem exercise_3_2_11 {G : Type*} [group G] {H K : subgroup G}
  (hHK : H ≤ K) :
  H.index = K.index * H.relindex K :=

Let $H \leq K \leq G$. Prove that $|G: H|=|G: K| \cdot|K: H|$ (do not assume $G$ is finite).

\begin{proof}

    Proof. Let $G$ be a group and let $I$ be a nonempty set of indices, not necessarily countable. Consider the collection of subgroups $\left\{N_\alpha \mid \alpha \in I\right\}$, where $N_\alpha \unlhd G$ for each $\alpha \in I$. Let

$$

N=\bigcap_{\alpha \in I} N_\alpha .

$$

We know $N$ is a subgroup of $G$.

For any $g \in G$ and any $n \in N$, we must have $n \in N_\alpha$ for each $\alpha$. And since $N_\alpha \unlhd G$, we have $g n g^{-1} \in N_\alpha$ for each $\alpha$. Therefore $g n g^{-1} \in N$, which shows that $g N g^{-1} \subseteq N$ for each $g \in G$. As before, this is enough to complete the proof.

\end{proof}


theorem exercise_3_2_21a (H : add_subgroup ℚ) (hH : H ≠ ⊤) : H.index = 0 :=

Prove that $\mathbb{Q}$ has no proper subgroups of finite index.

\begin{proof}

    Solution: We begin with a lemma.

Lemma: If $D$ is a divisible abelian group, then no proper subgroup of $D$ has finite index.

Proof: We saw previously that no finite group is divisible and that every proper quotient $D / A$ of a divisible group is divisible; thus no proper quotient of a divisible group is finite. Equivalently, $[D: A]$ is not finite.

Because $\mathbb{Q}$ and $\mathbb{Q} / \mathbb{Z}$ are divisible, the conclusion follows.

\end{proof}


theorem exercise_3_4_1 (G : Type*) [comm_group G] [is_simple_group G] :
    is_cyclic G ∧ ∃ G_fin : fintype G, nat.prime (@card G G_fin) :=

Prove that if $G$ is an abelian simple group then $G \cong Z_{p}$ for some prime $p$ (do not assume $G$ is a finite group).

\begin{proof}

    Solution: Let $G$ be an abelian simple group.

Suppose $G$ is infinite. If $x \in G$ is a nonidentity element of finite order, then $\langle x\rangle<G$ is a nontrivial normal subgroup, hence $G$ is not simple. If $x \in G$ is an element of infinite order, then $\left\langle x^2\right\rangle$ is a nontrivial normal subgroup, so $G$ is not simple.

Suppose $G$ is finite; say $|G|=n$. If $n$ is composite, say $n=p m$ for some prime $p$ with $m \neq 1$, then by Cauchy's Theorem $G$ contains an element $x$ of order $p$ and $\langle x\rangle$ is a nontrivial normal subgroup. Hence $G$ is not simple. Thus if $G$ is an abelian simple group, then $|G|=p$ is prime. We saw previously that the only such group up to isomorphism is $\mathbb{Z} /(p)$, so that $G \cong \mathbb{Z} /(p)$. Moreover, these groups are indeed simple.

\end{proof}


theorem exercise_3_4_5a {G : Type*} [group G]
  (H : subgroup G) [is_solvable G] : is_solvable H :=

Prove that subgroups of a solvable group are solvable.

\begin{proof}

    Let $G$ be a solvable group and let $H \leq G$. Since $G$ is solvable, we may find a chain of subgroups

$$

1=G_0 \unlhd G_1 \unlhd G_2 \unlhd \cdots \unlhd G_n=G

$$

so that each quotient $G_{i+1} / G_i$ is abelian. For each $i$, define

$$

H_i=G_i \cap H, \quad 0 \leq i \leq n .

$$

Then $H_i \leq H_{i+1}$ for each $i$. Moreover, if $g \in H_{i+1}$ and $x \in H_i$, then in particular $g \in G_{i+1}$ and $x \in G_i$, so that

$$

g x g^{-1} \in G_i

$$

because $G_i \unlhd G_{i+1}$. But $g$ and $x$ also belong to $H$, so

$$

g x g^{-1} \in H_i,

$$

which shows that $H_i \unlhd H_{i+1}$ for each $i$.

Next, note that

$$

H_i=G_i \cap H=\left(G_i \cap G_{i+1}\right) \cap H=G_i \cap H_{i+1} .

$$

By the Second Isomorphism Theorem, we then have

$$

H_{i+1} / H_i=H_{i+1} /\left(H_{i+1} \cap G_i\right) \cong H_{i+1} G_i / G_i \leq G_{i+1} / G_i .

$$

Since $H_{i+1} / H_i$ is isomorphic to a subgroup of the abelian group $G_{i+1} / G_i$, it follows that $H_{i+1} / H_i$ is also abelian. This completes the proof that $H$ is solvable.

\end{proof}


theorem exercise_3_4_11 {G : Type*} [group G] [is_solvable G]
  {H : subgroup G} (hH : H ≠ ⊥) [H.normal] :
  ∃ A ≤ H, A.normal ∧ ∀ a b : A, a*b = b*a :=

Prove that if $H$ is a nontrivial normal subgroup of the solvable group $G$ then there is a nontrivial subgroup $A$ of $H$ with $A \unlhd G$ and $A$ abelian.

\begin{proof}

    Suppose $H$ is a nontrivial normal subgroup of the solvable group $G$.

First, notice that $H$, being a subgroup of a solvable group, is itself solvable. By exercise $8, H$ has a chain of subgroups

$$

1 \leq H_1 \leq \ldots \leq H

$$

such that each $H_i$ is a normal subgroup of $H$ itself and $H_{i+1} / H_i$ is abelian. But then the first group in the series

$$

H_1 / 1 \cong H

$$

is an abelian subgroup of $H$.

\end{proof}


theorem exercise_4_3_26 {α : Type*} [fintype α] (ha : fintype.card α > 1)
  (h_tran : ∀ a b: α, ∃ σ : equiv.perm α, σ a = b) :
  ∃ σ : equiv.perm α, ∀ a : α, σ a ≠ a :=

Let $G$ be a transitive permutation group on the finite set $A$ with $|A|>1$. Show that there is some $\sigma \in G$ such that $\sigma(a) \neq a$ for all $a \in A$.

\begin{proof}

    Let $G$ be a transitive permutation group on the finite set $A,|A|>1$. We want to find an element $\sigma$ which doesn't stabilize anything, that is, we want a $\sigma$ such that

$$

\sigma \notin G_a

$$

for all $a \in A$.

Since the group is transitive, there is always a $g \in G$ such that $b=g \cdot a$. Let us see in what relationship the stabilizers of $a$ and $b$ are. We find

$$

\begin{aligned}

G_b & =\{h \in G \mid h \cdot b=b\} \\

& =\{h \in G \mid h g \cdot a=g \cdot a\} \\

& =\left\{h \in G \mid g^{-1} h g \cdot a=a\right\}

\end{aligned}

$$

Putting $h^{\prime}=g^{-1} h g$, we have $h=g h^{\prime} g^{-1}$ and

$$

\begin{aligned}

G_b & =g\left\{h^{\prime} \in H \mid h^{\prime} \cdot a=a\right\} g^{-1} \\

& =g G_a g^{-1}

\end{aligned}

$$

By the above, the stabilizer subgroup of any element is conjugate to some other stabilizer subgroup. Now, the stabilizer cannot be all of $G$ (else $\{a\}$ would be a orbit). Thus it is a proper subgroup of $G$. By the previous exercise, we have

$$

\bigcup_{a \in A} G_a=\bigcup_{g \in G} g G_a g^{-1} \subset G

$$

(the union of conjugates of a proper subgroup can never be all of $G$ ). This shows there is an element $\sigma$ which is not in any stabilizer of any element of $A$. Then $\sigma(a) \neq a$ for all $a \in A$, as we wanted to show.

\end{proof}


theorem exercise_4_2_14 {G : Type*} [fintype G] [group G]
  (hG : ¬ (card G).prime) (hG1 : ∀ k ∣ card G,
  ∃ (H : subgroup G) (fH : fintype H), @card H fH = k) :
  ¬ is_simple_group G :=

Let $G$ be a finite group of composite order $n$ with the property that $G$ has a subgroup of order $k$ for each positive integer $k$ dividing $n$. Prove that $G$ is not simple.

\begin{proof}

    Solution: Let $p$ be the smallest prime dividing $n$, and write $n=p m$. Now $G$ has a subgroup $H$ of order $m$, and $H$ has index $p$. Then $H$ is normal in $G$.

\end{proof}


theorem exercise_4_4_6a {G : Type*} [group G] (H : subgroup G)
  [subgroup.characteristic H] : subgroup.normal H  :=

Prove that characteristic subgroups are normal.

\begin{proof}

    Let $H$ be a characterestic subgroup of $G$. By definition $\alpha(H) \subset H$ for every $\alpha \in \operatorname{Aut}(G)$. So, $H$ is in particular invariant under the inner automorphism. Let $\phi_g$ denote the conjugation automorphism by $g$. Then $\phi_g(H) \subset H \Longrightarrow$ $g H g^{-1} \subset H$. So, $H$ is normal.

\end{proof}


theorem exercise_4_4_7 {G : Type*} [group G] {H : subgroup G} [fintype H]
  (hH : ∀ (K : subgroup G) (fK : fintype K), card H = @card K fK → H = K) :
  H.characteristic :=

If $H$ is the unique subgroup of a given order in a group $G$ prove $H$ is characteristic in $G$.

\begin{proof}

    Let $G$ be group and $H$ be the unique subgroup of order $n$. Now, let $\sigma \in \operatorname{Aut}(G)$. Now Clearly $|\sigma(G)|=n$, because $\sigma$ is a one-one onto map. But then as $H$ is the only subgroup of order $n$, and because of the fact that a automorphism maps subgroups to subgroups, we have $\sigma(H)=$ $H$ for every $\sigma \in \operatorname{Aut}(G)$. Hence, $H$ is a characterestic subgroup of $G$.

\end{proof}


theorem exercise_4_5_1a {p : ℕ} {G : Type*} [group G]
  {P : subgroup G} (hP : is_p_group p P) (H : subgroup G)
  (hH : P ≤ H) : is_p_group p H :=

Prove that if $P \in \operatorname{Syl}_{p}(G)$ and $H$ is a subgroup of $G$ containing $P$ then $P \in \operatorname{Syl}_{p}(H)$.

\begin{proof}

If $P \leq H \leq G$ is a Sylow $p$-subgroup of $G$, then $p$ does not divide $[G: P]$. Now $[G: P]=[G: H][H: P]$, so that $p$ does not divide $[H: P]$; hence $P$ is a Sylow $p$-subgroup of $H$.

\end{proof}


theorem exercise_4_5_14 {G : Type*} [group G] [fintype G]
  (hG : card G = 312) :
  ∃ (p : ℕ) (P : sylow p G), P.normal :=

Prove that a group of order 312 has a normal Sylow $p$-subgroup for some prime $p$ dividing its order.

\begin{proof}

    Since $|G|=351=3^{2}.13$, $G$ has $3-$Sylow subgroup of order $9$, as well as $13-$Sylow subgroup of order $13$. Now, we count the number of such subgroups. Let $n_{13}$ be the number of $13-$Sylow subgroup and $n_{3}$ be the number of  $3-$Sylow subgroup. Now $n_{13}=1+13k$ where $1+13k|9$. The choices for $k$ is $0$. Hence, there is a unique $13-$Sylow subgroup and hence is normal.

\end{proof}


theorem exercise_4_5_16 {p q r : ℕ} {G : Type*} [group G]
  [fintype G]  (hpqr : p < q ∧ q < r)
  (hpqr1 : p.prime ∧ q.prime ∧ r.prime)(hG : card G = p*q*r) :
  nonempty (sylow p G) ∨ nonempty(sylow q G) ∨ nonempty(sylow r G) :=

Let $|G|=p q r$, where $p, q$ and $r$ are primes with $p<q<r$. Prove that $G$ has a normal Sylow subgroup for either $p, q$ or $r$.

\begin{proof}

    Let $|G|=p q r$. We also assume $p<q<r$. We prove that $G$ has a normal Sylow subgroup of $p$, $q$ or $r$. Now, Let $n_p, n_q, n_r$ be the number of Sylow-p subgroup, Sylow-q subgroup, Sylow-r subgroup resp. So, we have $n_r=1+r k$ such that $1+r k \mid p q$. So, in this case as $r$ is greatest $n_r$ can be 1 or $p q$. We assume $n_r=p q$. Now we have $n_q=1+q k$ such that $1+q k \mid p r$. Now,as $p<q<r, n_q$ can be 1 or $r$, or $p r$. Assume that $n_q=r$. Now we turn to $n_p$. Again my similar method we can conclude $n_p$ can be $1, q, r$, or $q r$. We assume that $n_p$ is $q$. Now we count the number of elements of order $p, q, r$. Since $n_r=p q$, the number of elements of order $r$ is $p q(r-1)$. Since $n_q=r$, the number of elements of order $q$ is $(q-1) r$. And as $n_p=q$, the number of elements of order $p$ is $(p-1) q$. So, in total we get $p q(r-1)+(q-1) r+(p-$ 1) $q=p q r+q r-r-q=p q r+r(q-1)-r$. But observe that as $q>1, r(q-1)-r>$ 0 . So the number of elements exceeds $p q r$. So, it proves that atleast $n_p$ or $n_q$ or $n_r$ is 1, which ultimately proves the result, because a unique Sylow-p subgroup is always normal.

\end{proof}


theorem exercise_4_5_18 {G : Type*} [fintype G] [group G]
  (hG : card G = 200) :
  ∃ N : sylow 5 G, N.normal :=

Prove that a group of order 200 has a normal Sylow 5-subgroup.

\begin{proof}

    Let $G$ be a group of order $200=5^2 \cdot 8$. Note that 5 is a prime not dividing 8 . Let $P \in$ $S y l_5(G)$. [We know $P$ exists since $S y l_5(G) \neq \emptyset$ by Sylow's Theorem]

The number of Sylow 5-subgroups of $G$ is of the form $1+k \cdot 5$, i.e., $n_5 \equiv 1(\bmod 5)$ and $n_5$ divides 8 . The only such number that divides 8 and equals $1 (\bmod 5)$ is 1 so $n_5=1$. Hence $P$ is the unique Sylow 5-subgroup.

Since $P$ is the unique Sylow 5-subgroup, this implies that $P$ is normal in $G$.

\end{proof}


theorem exercise_4_5_20 {G : Type*} [fintype G] [group G]
  (hG : card G = 1365) : ¬ is_simple_group G :=

Prove that if $|G|=1365$ then $G$ is not simple.

\begin{proof}

Since $|G|=1365=3.5.7.13$, $G$ has $13-$Sylow subgroup of order $13$. Now, we count the number of such subgroups. Let $n_{13}$ be the number of $13-$Sylow subgroup. Now $n_{13}=1+13k$ where $1+13k|3.5.7$. The choices for $k$ is $0$. Hence, there is a unique $13-$Sylow subgroup and hence is normal. so $G$ is not simple.

\end{proof}


theorem exercise_4_5_22 {G : Type*} [fintype G] [group G]
  (hG : card G = 132) : ¬ is_simple_group G :=

Prove that if $|G|=132$ then $G$ is not simple.

\begin{proof}

Since $|G|=132=2^{2}.3.11$, $G$ has $2-$Sylow subgroup of order $4$, as well as $11-$Sylow subgroup of order $11$, and $3-$Sylow subgroup of order $3$. Now, we count the number of such subgroups. Let $n_{11}$ be the number of  $11-$Sylow subgroup and $n_{3}$ be the number of  $3-$Sylow subgroup. Now $n_{11}=1+11k$ where $1+11k|12$. The choices for $k$ are $0$ or $1$. If $k=0$, there is only one $11-$Sylow subgroup and hence normal. So, assume now, that there are $12$ $11-$Sylow subgroup(for $k=1$). Now we look at $3-$ Sylow subgroups. $n_{3}=1+3k| 44$. So choice for $k$ are $0$, $1$, and $7$. If $k=0$, there is only one $3-$Sylow subgroup and hence normal. So, assume now, that there are $4$ $2-$Sylow subgroup (for $k=3$). Now we claim that simultaneously, there cannot be $12$ $11-$Sylow subgroup and $4$ $3-$Sylow subgroups provided there is more than one $2-$Sylow subgroups. So, either $2-$Sylow subgroup is normal or if not, then, either $11-$Sylow subgroup is normal being unique, or  the $3-$Sylow subgroup is normal(We don't consider the possibility of $22$ $3-$Sylow subgroup because of obvious reason). Now, to prove the claim, we observe that there are $120$ elements of order $11$. Also there are $8$ elements of order $3$. So we already get $120+8+1=129$ distinct elements in the group. Let us count the number of $2-$Sylow subgroups in $G$. $n_{2}=1+2k|33$. The possibilities for $k$ are $0$, $1$, $5$, $16$. Now, assume there is more than one $2-$Sylow subgroups. Let $H_{1}$ and $H_{2}$ be two distinct  $2-$Sylow subgroup. Now $|H_{1}|=4$. So we already get $129+3=132$ distinct elements in the group. Now $H_{2}$ being distinct from $H_{1}$, has at least one element which is not in $H_{1}$. This adds one more element in the group, at the least. Now already we have number of elements in the group exceeding the number of element in $G$. This gives a contradiction and proves the claim.

Hence $G$ is not simple.

\end{proof}


theorem exercise_4_5_28 {G : Type*} [group G] [fintype G]
  (hG : card G = 105) (P : sylow 3 G) [hP : P.normal] :
  comm_group G :=

Let $G$ be a group of order 105. Prove that if a Sylow 3-subgroup of $G$ is normal then $G$ is abelian.

\begin{proof}

    Given that $G$ is a group of order $1575=3^2 .5^2 .7$. Now, Let $n_p$ be the number of Sylow-p subgroups. It is given that Sylow-3 subgroup is normal and hence is unique, so $n_3=1$. First we prove that both Sylow-5 subgroup and Sylow 7-subgroup are normal. Let $P$ be the Sylow3 subgroup. Now, Consider $G / P$, which has order $5^2 .7$. Now, the number of Sylow $-5$ subgroup of $G / P$ is given by $1+5 k$, where $1+5 k \mid 7$. Clearly $k=0$ is the only choice and hence there is a unique Sylow-5 subgroup of $G / P$, and hence normal. In the same way Sylow-7 subgroup of $G / P$ is also unique and hence normal. Consider now the canonical map $\pi: G \rightarrow G / P$. The inverse image of Sylow-5 subgroup of $G / P$ under $\pi$, call it $H$, is a normal subgroup of $G$, and $|H|=3^2 .5^2$. Similarly, the inverse image of Sylow-7 subgroup of $G / P$ under $\pi$ call it $K$ is also normal in $G$ and $|K|=3^2 .7$. Now, consider $H$. Observe first that the number of Sylow-5 subgroup in $H$ is $1+5 k$ such that $1+5 k \mid 9$. Again $k=0$ and hence $H$ has a unique Sylow-5 subgroup, call it $P_1$. But, it is easy to see that $P_1$ is also a Sylow-5 subgroup of $G$, because $\left|P_1\right|=25$. But now any other Sylow 5 subgroup of $G$ is of the form $g P_1 g^{-1}$ for some $g \in G$. But observe that since $P_1 \subset H$ and $H$ is normal in $G$, so $g P_1 g^1 \subset H$, and $g P_1 g^{-1}$ is also Sylow-5 subgroup of $H$. But, then as Sylow-5 subgroup of $H$ is unique we have $g P_1 g^{-1}=P_1$. This shows that Sylow-5 subgroup of $G$ is unique and hence normal in $G$.

Similarly, one can argue the same for $K$ and deduce that Sylow-7 subgroup of $G$ is unique and hence normal. So, the first part of the problem is done.

\end{proof}


theorem exercise_5_4_2 {G : Type*} [group G] (H : subgroup G) :
  H.normal ↔ ⁅(⊤ : subgroup G), H⁆ ≤ H :=

Prove that a subgroup $H$ of $G$ is normal if and only if $[G, H] \leq H$.

\begin{proof}

    $H \unlhd G$ is equivalent to $g^{-1} h g \in H, \forall g \in G, \forall h \in H$. We claim that holds if and only if $h^{-1} g^{-1} h g \in H, \forall g \in G, \forall h \in H$, i.e., $\left\{h^{-1} g^{-1} h g: h \in H, g \in G\right\} \subseteq H$. That holds by the following argument:

If $g^{-1} h g \in H, \forall g \in G, \forall h \in H$, note that $h^{-1} \in H$, so multiplying them, we also obtain an element of $H$.

On the other hand, if $h^{-1} g^{-1} h g \in H, \forall g \in G, \forall h \in H$, then

$$

h h^{-1} g^{-1} h g=g^{-1} h g \in H, \forall g \in G, \forall h \in H .

$$

Since $\left\{h^{-1} g^{-1} h g: h \in H, g \in G\right\} \subseteq H \Leftrightarrow\left\langle\left\{h^{-1} g^{-1} h g: h \in H, g \in G\right\}\right\rangle \leq H$, we've solved the exercise by definition of $[H, G]$.

\end{proof}


theorem exercise_7_1_11 {R : Type*} [ring R] [is_domain R]
  {x : R} (hx : x^2 = 1) : x = 1 ∨ x = -1 :=

Prove that if $R$ is an integral domain and $x^{2}=1$ for some $x \in R$ then $x=\pm 1$.

\begin{proof}

    Solution: If $x^2=1$, then $x^2-1=0$. Evidently, then,

$$

(x-1)(x+1)=0 .

$$

Since $R$ is an integral domain, we must have $x-1=0$ or $x+1=0$; thus $x=1$ or $x=-1$.

\end{proof}


theorem exercise_7_1_15 {R : Type*} [ring R] (hR : ∀ a : R, a^2 = a) :
  comm_ring R :=

A ring $R$ is called a Boolean ring if $a^{2}=a$ for all $a \in R$. Prove that every Boolean ring is commutative.

\begin{proof}

    Solution: Note first that for all $a \in R$,

$$

-a=(-a)^2=(-1)^2 a^2=a^2=a .

$$

Now if $a, b \in R$, we have

$$

a+b=(a+b)^2=a^2+a b+b a+b^2=a+a b+b a+b .

$$

Thus $a b+b a=0$, and we have $a b=-b a$. But then $a b=b a$. Thus $R$ is commutative.

\end{proof}


theorem exercise_7_2_12 {R G : Type*} [ring R] [group G] [fintype G] :
  ∑ g : G, monoid_algebra.of R G g ∈ center (monoid_algebra R G) :=

Let $G=\left\{g_{1}, \ldots, g_{n}\right\}$ be a finite group. Prove that the element $N=g_{1}+g_{2}+\ldots+g_{n}$ is in the center of the group ring $R G$.

\begin{proof}

    Let $M=\sum_{i=1}^n r_i g_i$ be an element of $R[G]$. Note that for each $g_i \in G$, the action of $g_i$ on $G$ by conjugation permutes the subscripts. Then we have the following.

$$

\begin{aligned}

N M &=\left(\sum_{i=1}^n g_i\right)\left(\sum_{j=1}^n r_j g_j\right) \\

&=\sum_{j=1}^n \sum_{i=1}^n r_j g_i g_j \\

&=\sum_{j=1}^n \sum_{i=1}^n r_j g_j g_j^{-1} g_i g_j \\

&=\sum_{j=1}^n r_j g_j\left(\sum_{i=1}^n g_j^{-1} g_i g_j\right) \\

&=\sum_{j=1}^n r_j g_j\left(\sum_{i=1}^n g_i\right) \\

&=\left(\sum_{j=1}^n r_j g_j\right)\left(\sum_{i=1}^n g_i\right) \\

&=M N .

\end{aligned}

$$

Thus $N \in Z(R[G])$.

\end{proof}


theorem exercise_7_3_37 {R : Type*} {p m : ℕ} (hp : p.prime)
  (N : ideal $ zmod $ p^m) :
  is_nilpotent N ↔  is_nilpotent (ideal.span ({p} : set $ zmod $ p^m)) :=

An ideal $N$ is called nilpotent if $N^{n}$ is the zero ideal for some $n \geq 1$. Prove that the ideal $p \mathbb{Z} / p^{m} \mathbb{Z}$ is a nilpotent ideal in the ring $\mathbb{Z} / p^{m} \mathbb{Z}$.

\begin{proof}

    First we prove a lemma.

Lemma: Let $R$ be a ring, and let $I_1, I_2, J \subseteq R$ be ideals such that $J \subseteq I_1, I_2$. Then $\left(I_1 / J\right)\left(I_2 / J\right)=I_1 I_2 / J$.

Proof: ( $\subseteq$ ) Let

$$

\alpha=\sum\left(x_i+J\right)\left(y_i+J\right) \in\left(I_1 / J\right)\left(I_2 / J\right) .

$$

Then

$$

\alpha=\sum\left(x_i y_i+J\right)=\left(\sum x_i y_i\right)+J \in\left(I_1 I_2\right) / J .

$$

Now let $\alpha=\left(\sum x_i y_i\right)+J \in\left(I_1 I_2\right) / J$. Then

$$

\alpha=\sum\left(x_i+J\right)\left(y_i+J\right) \in\left(I_1 / J\right)\left(I_2 / J\right) .

$$

From this lemma and the lemma to Exercise 7.3.36, it follows by an easy induction that

$$

\left(p \mathbb{Z} / p^m \mathbb{Z}\right)^m=(p \mathbb{Z})^m / p^m \mathbb{Z}=p^m \mathbb{Z} / p^m \mathbb{Z} \cong 0 .

$$

Thus $p \mathbb{Z} / p^m \mathbb{Z}$ is nilpotent in $\mathbb{Z} / p^m \mathbb{Z}$.

\end{proof}


theorem exercise_8_1_12 {N : ℕ} (hN : N > 0) {M M': ℤ} {d : ℕ}
  (hMN : M.gcd N = 1) (hMd : d.gcd N.totient = 1)
  (hM' : M' ≡ M^d [ZMOD N]) :
  ∃ d' : ℕ, d' * d ≡ 1 [ZMOD N.totient] ∧
  M ≡ M'^d' [ZMOD N] :=

Let $N$ be a positive integer. Let $M$ be an integer relatively prime to $N$ and let $d$ be an integer relatively prime to $\varphi(N)$, where $\varphi$ denotes Euler's $\varphi$-function. Prove that if $M_{1} \equiv M^{d} \pmod N$ then $M \equiv M_{1}^{d^{\prime}} \pmod N$ where $d^{\prime}$ is the inverse of $d \bmod \varphi(N)$: $d d^{\prime} \equiv 1 \pmod {\varphi(N)}$.

\begin{proof}

    Note that there is some $k \in \mathbb{Z}$ such that $M^{d d^{\prime}} \equiv M^{k \varphi(N)+1} \equiv\left(M^{\varphi(N)}\right)^k \cdot M \bmod N$. By Euler's Theorem we have $M^{\varphi(N)} \equiv 1 \bmod N$, so that $M_1^{d^{\prime}} \equiv M \bmod N$.

\end{proof}


theorem exercise_8_3_4 {R : Type*} {n : ℤ} {r s : ℚ}
  (h : r^2 + s^2 = n) :
  ∃ a b : ℤ, a^2 + b^2 = n :=

Prove that if an integer is the sum of two rational squares, then it is the sum of two integer squares.

\begin{proof}

    Let $n=\frac{a^2}{b^2}+\frac{c^2}{d^2}$, or, equivalently, $n(b d)^2=a^2 d^2+c^2 b^2$. From this, we see that $n(b d)^2$ can be written as a sum of two squared integers. Therefore, if $q \equiv 3(\bmod 4)$ and $q^i$ appears in the prime power factorization of $n, i$ must be even. Let $j \in \mathbb{N} \cup\{0\}$ such that $q^j$ divides $b d$. Then $q^{i-2 j}$ divides $n$. But since $i$ is even, $i-2 j$ is even as well. Consequently, $n$ can be written as a sum of two squared integers.

\end{proof}


theorem exercise_8_3_6a {R : Type*} [ring R]
  (hR : R = (gaussian_int ⧸ ideal.span ({⟨0, 1⟩} : set gaussian_int))) :
  is_field R ∧ ∃ finR : fintype R, @card R finR = 2 :=

Prove that the quotient ring $\mathbb{Z}[i] /(1+i)$ is a field of order 2.

\begin{proof}

    Let $a+b i \in \mathbb{Z}[i]$. If $a \equiv b \bmod 2$, then $a+b$ and $b-a$ are even and $(1+i)\left(\frac{a+b}{2}+\frac{b-a}{2} i\right)=a+b i \in\langle 1+i\rangle$. If $a \not \equiv b \bmod 2$ then $a-1+b i \in\langle 1+i\rangle$. Therefore every element of $\mathbb{Z}[i]$ is in either $\langle 1+i\rangle$ or $1+\langle 1+i\rangle$, so $\mathbb{Z}[i] /\langle 1+i\rangle$ is a finite ring of order 2 , which must be a field.

\end{proof}


theorem exercise_9_1_6 : ¬ is_principal
  (ideal.span ({X 0, X 1} : set (mv_polynomial (fin 2) ℚ))) :=

Prove that $(x, y)$ is not a principal ideal in $\mathbb{Q}[x, y]$.

\begin{proof}

    Suppose, to the contrary, that $(x, y)=p$ for some polynomial $p \in \mathbb{Q}[x, y]$. From $x, y \in$ $(x, y)=(p)$ there are $s, t \in \mathbb{Q}[x, y]$ such that $x=s p$ and $y=t p$.

Then:

$$

\begin{aligned}

& 0=\operatorname{deg}_y(x)=\operatorname{deg}_y(s)+\operatorname{deg}_y(p) \text { so } \\

& 0=\operatorname{deg}_y(p) \\

& 0=\operatorname{deg}_x(y)=\operatorname{deg}_x(s)+\operatorname{deg}_x(p) \text { so } \\

& 0=\operatorname{deg}_x(p) \text { so }

\end{aligned}

$$

From : $\quad 0=\operatorname{deg}_y(p)=\operatorname{deg}_x(p)$ we get $\operatorname{deg}(p)=0$ and $p \in \mathbb{Q}$.

But $p \in(p)=(x, y)$ so $p=a x+b y$ for some $a, b \in \mathbb{Q}[x, y]$

$$

\begin{aligned}

\operatorname{deg}(p) & =\operatorname{deg}(a x+b y) \\

& =\min (\operatorname{deg}(a)+\operatorname{deg}(x), \operatorname{deg}(b)+\operatorname{deg}(y)) \\

& =\min (\operatorname{deg}(a)+1, \operatorname{deg}(b)+1) \geqslant 1

\end{aligned}

$$

which contradicts $\operatorname{deg}(p)=0$.

So we conclude that $(x, y)$ is not principal ideal in $\mathbb{Q}[x, y]$

\end{proof}


theorem exercise_9_3_2 {f g : polynomial ℚ} (i j : ℕ)
  (hfg : ∀ n : ℕ, ∃ a : ℤ, (f*g).coeff = a) :
  ∃ a : ℤ, f.coeff i * g.coeff j = a :=

Prove that if $f(x)$ and $g(x)$ are polynomials with rational coefficients whose product $f(x) g(x)$ has integer coefficients, then the product of any coefficient of $g(x)$ with any coefficient of $f(x)$ is an integer.

\begin{proof}

    Let $f(x), g(x) \in \mathbb{Q}[x]$ be such that $f(x) g(x) \in \mathbb{Z}[x]$.

By Gauss' Lemma there exists $r, s \in \mathbb{Q}$ such that $r f(x), s g(x) \in \mathbb{Z}[x]$, and $(r f(x))(s g(x))=r s f(x) g(x)=f(x) g(x)$. From this last relation we can conclude that $s=r^{-1}$.

Therefore for any coefficient $f_i$ of $f(x)$ and $g_j$ of $g(x)$ we have that $r f_i, r^{-1} g_j \in$ $\mathbb{Z}$ and by multiplicative closure and commutativity of $\mathbb{Z}$ we have that $r f_i r^{-1} g_j=$ $f_i g_j \in \mathbb{Z}$

\end{proof}


theorem exercise_9_4_2b : irreducible
  (X^6 + 30*X^5 - 15*X^3 + 6*X - 120 : polynomial ℤ) :=

Prove that $x^6+30x^5-15x^3 + 6x-120$ is irreducible in $\mathbb{Z}[x]$.

\begin{proof}

    $$

x^6+30 x^5-15 x^3+6 x-120

$$

The coefficients of the low order.: $30,-15,0,6,-120$

They are divisible by the prime 3 , but $3^2=9$ doesn 't divide $-120$. So this polynomial is irreducible over $\mathbb{Z}$.

\end{proof}


theorem exercise_9_4_2d {p : ℕ} (hp : p.prime ∧ p > 2)
  {f : polynomial ℤ} (hf : f = (X + 2)^p):
  irreducible (∑ n in (f.support - {0}), (f.coeff n) * X ^ (n-1) :
  polynomial ℤ) :=

Prove that $\frac{(x+2)^p-2^p}{x}$, where $p$ is an odd prime, is irreducible in $\mathbb{Z}[x]$.

\begin{proof}

$\frac{(x+2)^p-2^p}{x} \quad \quad p$ is on add pprime $Z[x]$

$$

\frac{(x+2)^p-2^p}{x} \quad \text { as a polynomial we expand }(x+2)^p

$$

$2^p$ cancels with $-2^p$, every remaining term has $x$ as $a$ factor

$$

\begin{aligned}

& x^{p-1}+2\left(\begin{array}{l}

p \\

1

\end{array}\right) x^{p-2}+2^2\left(\begin{array}{l}

p \\

2

\end{array}\right) x^{p-3}+\ldots+2^{p-1}\left(\begin{array}{c}

p \\

p-1

\end{array}\right) \\

& 2^k\left(\begin{array}{l}

p \\

k

\end{array}\right) x^{p-k-1}=2^k \cdot p \cdot(p-1) \ldots(p-k-1), \quad 0<k<p

\end{aligned}

$$

Every lower order coef. has $p$ as a factor but doesnt have $\$ \mathrm{p}^{\wedge} 2 \$$ as a fuction so the polynomial is irreducible by Eisensteins Criterion.

\end{proof}


theorem exercise_9_4_11 :
  irreducible ((X 0)^2 + (X 1)^2 - 1 : mv_polynomial (fin 2) ℚ) :=

Prove that $x^2+y^2-1$ is irreducible in $\mathbb{Q}[x,y]$.

\begin{proof}

$$

p(x)=x^2+y^2-1 \in Q[y][x] \cong Q[y, x]

$$

We have that $y+1 \in Q[y]$ is prime and $Q[y]$ is an UFD, since $p(x)=x^2+y^2-1=x^2+$ $(y+1)(y-1)$ by the Eisenstein criterion $x^2+y^2-1$ is irreducibile in $Q[x, y]$.

\end{proof}