Theorem: Gauss's Digamma Theorem

:$\ds \map \psi {\dfrac p q} = -\gamma - \ln 2 q - \dfrac \pi 2 \map \cot {\dfrac p q \pi} + 2 \sum_{n \mathop = 1}^{\ceiling {q / 2} - 1} \map \cos {\dfrac {2 \pi p n} q} \map \ln {\map \sin {\dfrac {\pi n} q} }$

Proof:
We now note:
{{begin-eqn}}
{{eqn | l = \map \psi {z + 1}
      | r = -\gamma + \harm 1 z
      | c = Digamma Function in terms of General Harmonic Number
}}
{{eqn | ll= \leadsto
      | l = \map \psi {\dfrac p q}
      | r = -\gamma + \harm 1 {\dfrac p q - 1}
      | c = $\paren {z + 1} := \dfrac p q$
}}
{{eqn | r = -\gamma + \sum_{n \mathop = 1}^\infty \paren {\frac 1 n - \frac 1 {\paren {\dfrac p q - 1} + n} }
      | c = {{Defof|General Harmonic Numbers}}
}}
{{eqn | r = -\gamma + \sum_{n \mathop = 0}^\infty \paren {\frac 1 {n + 1} - \frac 1 {\paren {\dfrac p q} + n} }
      | c = re-indexing the sum
}}
{{eqn | r = -\gamma + \sum_{n \mathop = 0}^\infty \paren {\frac 1 {n + 1} - \frac 1 {\paren {\dfrac p q} + n} \times \dfrac q q }
      | c = multiplying top and bottom by q
}}
{{eqn | r = -\gamma + \sum_{n \mathop = 0}^\infty \paren {\frac 1 {n + 1} - \frac q {p + n q} }
      | c = 
}}
{{eqn | r = -\gamma + \lim_{t \mathop \to 1^-} \sum_{n \mathop = 0}^\infty \paren {\frac 1 {n + 1} - \frac q {p + n q} } t^{p + n q}
      | c = Abel's Limit Theorem: $\ds \lim_{x \mathop \to 1^-} \paren {\sum_{k \mathop = 0}^\infty a_k x^k} = \sum_{k \mathop = 0}^\infty a_k$
}}
{{eqn | r = -\gamma + \lim_{t \mathop \to 1^-} \paren {\sum_{n \mathop = 0}^\infty \paren {\frac {t^{p + n q} } {n + 1} } - \sum_{n \mathop = 0}^\infty \paren {\frac {q t^{p + n q} } {p + n q} } }
      | c = 
}}
{{eqn | r = -\gamma + \lim_{t \mathop \to 1^-} \paren {t^p \sum_{n \mathop = 1}^\infty \paren {\frac {t^{\paren {n - 1} q} } {\paren {n - 1} + 1} } - \sum_{n \mathop = 0}^\infty \paren {\frac {q t^{p + n q} } {p + n q} } }
      | c = factoring out $t^p$ and reindexing sum
}}
{{eqn | r = -\gamma + \lim_{t \mathop \to 1^-} \paren {t^{p - q} \sum_{n \mathop = 1}^\infty \paren {\frac {t^{\paren {n q} } } n } - \sum_{n \mathop = 0}^\infty \paren {\frac {q t^{p + n q} } {p + n q} } }
      | c = factoring out $t^{-q}$
}}
{{eqn | r = -\gamma + \lim_{t \mathop \to 1^-} \paren {-t^{p - q} \map \ln {1 - t^q} - q \sum_{n \mathop = 0}^\infty \paren {\frac {t^{p + n q} } {p + n q} } }
      | c = Power Series Expansion: $\ds \map \ln {1 - x} = -\sum_{n \mathop = 1}^\infty \dfrac {x^n} n$
}}
{{end-eqn}}
The term $\ds -q \sum_{n \mathop = 0}^\infty \paren {\frac {t^{p + n q} } {p + n q} }$ is $q$ multiplied by the Power Series Expansion: $\ds \map \ln {1 - t} = -\sum_{n \mathop = 1}^\infty \dfrac {t^n} n$, '''but only when $n \equiv p \pmod q$'''
From Simpson's Dissection: 
:$\ds \sum_{n \mathop = 0}^\infty a_{n q + p} x^{n q + p} = \dfrac 1 q \sum_{j \mathop = 0}^{q - 1} \omega^{- j p} \map f {\omega^j x}$
where $\omega = e^{2 i \pi/ q}$ is a primitive $q$th root of unity.
{{begin-eqn}}
{{eqn | l = \map \psi {\dfrac p q}
      | r = -\gamma + \lim_{t \mathop \to 1^-} \paren {-t^{p - q} \map \ln {1 - t^q} + \sum_{n \mathop = 0}^{q - 1} \omega^{-n p} \map \ln {1 - \omega^n t} }
      | c = Simpson's Dissection and Power Series Expansion: $\ds \map \ln {1 - x} = -\sum_{n \mathop = 1}^\infty \dfrac {x^n} n$
}}
{{eqn | r = -\gamma + \lim_{t \mathop \to 1^-} \paren {-t^{p - q} \map \ln {1 - t^q} + \paren {t^{p - q} \map \ln {1 - t} - t^{p - q} \map \ln {1 - t} } + \sum_{n \mathop = 0}^{q - 1} \omega^{-n p} \map \ln {1 - \omega^n t} }
      | c = adding $0$
}}
{{eqn | r = -\gamma + \lim_{t \mathop \to 1^-} \paren {-t^{p - q} \map \ln {1 - t^q} + \paren {t^{p - q} \map \ln {1 - t} - t^{p - q} \map \ln {1 - t} } + \map \ln {1 - t} + \sum_{n \mathop = 1}^{q - 1} \omega^{-n p} \map \ln {1 - \omega^n t} }
      | c = reindexing sum
}}
{{eqn | r = -\gamma + \lim_{t \mathop \to 1^-} \paren {-t^{p - q} \map \ln {\frac {1 - t^q} {1 - t} } - \paren {t^{p - q} - 1} \map \ln {1 - t} + \sum_{n \mathop = 1}^{q - 1} \omega^{-n p} \map \ln {1 - \omega^n t} }
      | c = Sum of Logarithms and Difference of Logarithms
}}
{{eqn | r = -\gamma + \lim_{t \mathop \to 1^-} \paren {-t^{p - q} \map \ln {\sum_{j \mathop = 0}^{q - 1} t^j } - \paren {t^{p - q} - 1} \map \ln {1 - t} + \sum_{n \mathop = 1}^{q - 1} \omega^{-n p} \map \ln {1 - \omega^n t} }
      | c = Sum of Geometric Sequence
}}
{{eqn | r = -\gamma - \map \ln {\sum_{j \mathop = 0}^{q - 1} 1 } + \sum_{n \mathop = 1}^{q - 1} \omega^{-n p} \map \ln {1 - \omega^n }
      | c = {{Corollary|Limit of Power of x by Absolute Value of Power of Logarithm of x}}
}}
{{eqn | ll= \leadsto
      | n = 1
      | l = \map \psi {\dfrac p q}
      | r = -\gamma - \map \ln q + \sum_{n \mathop = 1}^{q - 1} \omega^{-n p} \map \ln {1 - \omega^n }
      | c = 
}}
{{eqn | ll= \leadsto
      | l = \map \psi {1 - \dfrac p q}
      | r = -\gamma - \map \ln q + \sum_{n \mathop = 1}^{q - 1} \omega^{-n \paren {q - p} } \map \ln {1 - \omega^n }
      | c = Replace $p$ by $\paren {q - p}$
}}
{{eqn | ll= \leadsto
      | l = \map \psi {1 - \dfrac p q}
      | r = -\gamma - \map \ln q + \sum_{n \mathop = 1}^{q - 1} e^{\paren {-i 2 \pi n } } \omega^{n p} \map \ln {1 - \omega^n }
      | c = Product of Powers
}}
{{eqn | ll= \leadsto
      | n = 2
      | l = \map \psi {1 - \dfrac p q}
      | r = -\gamma - \map \ln q + \sum_{n \mathop = 1}^{q - 1} \omega^{n p} \map \ln {1 - \omega^n }
      | c = Cosine of Zero is One and Period of Real Cosine Function
}}
{{eqn | ll= \leadsto
      | l = \map \psi {\dfrac p q} + \map \psi {1 - \dfrac p q}
      | r = -2 \gamma - 2 \map \ln q + 2 \sum_{n \mathop = 1}^{q - 1} \dfrac {\paren {\omega^{-n p} + \omega^{n p} } } 2 \map \ln {1 - \omega^n} 
      | c = $(1) + (2)$ and multiplying top and bottom by $2$
}}
{{eqn | ll= \leadsto
      | l = \map \psi {\dfrac p q} + \map \psi {1 - \dfrac p q}
      | r = -2 \gamma - 2 \map \ln q + 2 \sum_{n \mathop = 1}^{q - 1} \map \cos {\dfrac {2 \pi n p} q } \map \ln {1 - \omega^n} 
      | c = Euler's Cosine Identity: $\cos z = \dfrac {e^{i z} + e^{-i z} } 2$
}}
{{eqn | ll= \leadsto
      | n = 3
      | l = \map \psi {\dfrac p q} + \map \psi {1 - \dfrac p q}
      | r = -2 \gamma - 2 \map \ln q + 2 \sum_{n \mathop = 1}^{q - 1} \map \cos {\dfrac {2 \pi n p} q } \map \ln {1 - \omega^n} 
      | c = 
}}
{{eqn | n = 4
      | l = \map \psi {\dfrac p q} - \map \psi {1 - \dfrac p q}
      | r = -\pi \map \cot {\dfrac {\pi p} q}
      | c = Digamma Reflection Formula
}}
{{eqn | ll= \leadsto
      | l = 2 \map \psi {\dfrac p q} 
      | r = -2 \gamma - 2 \map \ln q + 2 \sum_{n \mathop = 1}^{q - 1} \map \cos {\dfrac {2 \pi n p} q } \map \ln {1 - \omega^n} - \pi \map \cot {\dfrac {\pi p} q}
      | c = $(3) + (4)$
}}
{{eqn | ll= \leadsto
      | l = \map \psi {\dfrac p q} 
      | r = -\gamma - \map \ln q - \dfrac \pi 2 \map \cot {\dfrac {\pi p} q} + \sum_{n \mathop = 1}^{q - 1} \map \cos {\dfrac {2 \pi n p} q } \map \ln {1 - \omega^n}
      | c = dividing by $2$
}}
{{eqn | r = -\gamma - \map \ln q - \dfrac \pi 2 \map \cot {\dfrac {\pi p} q} + \sum_{n \mathop = 1}^{q - 1} \map \cos {\dfrac {2 \pi n p} q } \map \ln {1 - e^{\dfrac {2 i \pi n} q} }
      | c = 
}}
{{eqn | r = -\gamma - \map \ln q - \dfrac \pi 2 \map \cot {\dfrac {\pi p} q} + \sum_{n \mathop = 1}^{q - 1} \map \cos {\dfrac {2 \pi n p} q } \map \ln {1 - \map \cos {\dfrac {2 \pi n} q} - i \map \sin {\dfrac {2 \pi n} q} }
      | c = Euler's Formula
}}
{{end-eqn}}
Since the {{LHS}} $\map \psi {\dfrac p q}$ is a real number, we only want the real part of the natural logarithm.
This requires us to determine the modulus of the argument.
{{begin-eqn}}
{{eqn | l = \cmod z
      | r = \sqrt {a^2 + b^2}
      | c = {{Defof|Complex Modulus}}
}}
{{eqn | r = \paren {\paren {1 - \map \cos {\dfrac {2 \pi n} q} }^2 + \paren {\map \sin {\dfrac {2 \pi n} q} }^2 }^{\frac 1 2}
      | c = 
}}
{{eqn | r = \paren {1 - 2 \map \cos {\dfrac {2 \pi n} q} + \map {\cos^2} {\dfrac {2 \pi n} q} + \map {\sin^2} {\dfrac {2 \pi n} q} }^{\frac 1 2}
      | c = Square of Sum
}}
{{eqn | r = \paren {1 - 2 \map \cos {\dfrac {2 \pi n} q} + 1 }^{\frac 1 2}
      | c = Sum of Squares of Sine and Cosine
}}
{{eqn | r = \paren {2 - 2 \map \cos {\dfrac {2 \pi n} q} }^{\frac 1 2}
      | c = 
}}
{{end-eqn}}
Plugging this back into our main result:
{{begin-eqn}}
{{eqn | l = \map \psi {\dfrac p q} 
      | r = -\gamma - \map \ln q - \dfrac \pi 2 \map \cot {\dfrac {\pi p} q} + \sum_{n \mathop = 1}^{q - 1} \map \cos {\dfrac {2 \pi n p} q } \map \ln {2 - 2 \map \cos {\dfrac {2 \pi n} q} }^{\frac 1 2}
      | c = 
}}
{{eqn | r = -\gamma - \map \ln q - \dfrac \pi 2 \map \cot {\dfrac {\pi p} q} + \sum_{n \mathop = 1}^{q - 1} \map \cos {\dfrac {2 \pi n p} q } \map \ln {2 - 2 \paren {1 - 2 \map {\sin^2} {\dfrac {\pi n} q} } }^{\frac 1 2}
      | c = {{Corollary|Double Angle Formula for Cosine|2}}
}}
{{eqn | r = -\gamma - \map \ln q - \dfrac \pi 2 \map \cot {\dfrac {\pi p} q} + \sum_{n \mathop = 1}^{q - 1} \map \cos {\dfrac {2 \pi n p} q } \map \ln {2 \map \sin {\dfrac {\pi n} q } }
      | c = 
}}
{{eqn | r = -\gamma - \map \ln q - \dfrac \pi 2 \map \cot {\dfrac {\pi p} q} + \sum_{n \mathop = 1}^{q - 1} \map \cos {\dfrac {2 \pi n p} q } \paren {\map \ln 2 + \map \ln {\map \sin {\dfrac {\pi n} q } } }
      | c = Sum of Logarithms
}}
{{eqn | r = -\gamma - \map \ln q - \dfrac \pi 2 \map \cot {\dfrac {\pi p} q} + \sum_{n \mathop = 1}^{q - 1} \map \cos {\dfrac {2 \pi n p} q } \map \ln 2 + \sum_{n \mathop = 1}^{q - 1} \map \cos {\dfrac {2 \pi n p} q } \map \ln {\map \sin {\dfrac {\pi n} q } } 
      | c = 
}}
{{eqn | r = -\gamma - \map \ln q - \dfrac \pi 2 \map \cot {\dfrac {\pi p} q} - \map \ln 2 + \sum_{n \mathop = 1}^{q - 1} \map \cos {\dfrac {2 \pi n p} q } \map \ln {\map \sin {\dfrac {\pi n} q } } 
      | c = Sum of Cosines of Fractions of Pi: $\sum_{n \mathop = 1}^{q - 1} \map \cos {\dfrac {2 \pi n p} q } = -1$
}}
{{eqn | r = -\gamma - \map \ln {2 q} - \dfrac \pi 2 \map \cot {\dfrac {\pi p} q} + \sum_{n \mathop = 1}^{q - 1} \map \cos {\dfrac {2 \pi n p} q } \map \ln {\map \sin {\dfrac {\pi n} q } } 
      | c = Sum of Logarithms
}}
{{eqn | r = -\gamma - \ln 2 q - \dfrac \pi 2 \map \cot {\dfrac p q \pi} + 2 \sum_{n \mathop = 1}^{\ceiling {q / 2} - 1} \map \cos {\dfrac {2 \pi p n} q} \map \ln {\map \sin {\dfrac {\pi n} q} }
      | c = Cosine of Angle plus Full Angle, Cosine Function is Even and Sine of Supplementary Angle
}}
{{end-eqn}}
{{qed}}
{{Namedfor|Carl Friedrich Gauss|cat = Gauss}}