how to find $$\sum_{d|n}(-1)^{\frac nd}\phi(d)=?$$
2026-03-26 06:02:35.1774504955
On
$\sum_{d|n}(-1)^{\frac nd}\phi(d)={}$?
2.1k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
3
There are 3 best solutions below
2
On
Hint: For $n \ge 1$, $$\sum_{d|n}\phi(d)=n$$
Let $S=\{1,2,3,\dots n\}$. For every positive divisor $d$ of $n$, let $S_d=\{m \in S |\gcd(m,n)=d\}$.
Then clearly, these sets $S_d$ are pairwise disjoint and their union is $S$.
Also $\gcd(m,n)=d \iff \gcd\left(\dfrac{m}{d},\dfrac{n}{d}\right)=1$. Hence the number of integers in the set $S_d$ is equal to the number of positive integers $\le\frac{n}{d}$ which are relatively prime to $\frac{n}{d}$ i.e equal to $\phi(\frac{n}{d})$.
Hence $n= \sum_{d|n} \phi\left(\dfrac{n}{d}\right)$. But as $d$ runs through all positive divisors of $n$, so does $\frac{n}{d}$. Hence
$$\sum_{d|n} \phi\left(\frac{n}{d}\right)=\sum_{d|n} \phi(d)=n.$$
We consider this sum for parity of $n$
If $n$ is odd, then $(-1)^{d}=-1$ for all $d\mid n$. (Because $d$ is also odd.) So $$\sum_{d\mid n} (-1)^{n/d}\phi(d) = - \sum _{d\mid n} \phi(d)=-n$$
If $n$ is even, Let us take $n=2^r N$, where $N$ is an odd number and $r$ is a positive integer. Then this sum is represented in the following form: $$\begin{align*} \sum_{d\mid n} (-1)^{n/d}\phi(d) &= \sum_{i=0}^r \sum _{d\mid N} (-1)^{n/2^i d} \phi(2^i d) \\ &=\sum_{i=0}^{r-1} \sum_{d\mid N} (-1)^{n/2^i d} \phi(2^i d) + \sum_{d\mid N} (-1)^{N/d} \phi(2^r d)\\ &=\sum_{i=0}^{r-1} \sum_{d\mid N} \phi(2^i)\phi(d) - \sum_{d\mid N}\phi(2^r)\phi(d)\\ &=\sum_{i=0}^{r-1} \phi(2^i) \sum_{d\mid N} \phi(d) - \sum_{d\mid N}\phi(2^r)\phi(d)\\ &=2^{r-1}N - 2^{r-1}N=0 \end{align*} $$
So $$\sum_{d\mid n} (-1)^{n/d}\phi(d) = \begin{cases} -n & \text{if $n$ is odd} \\ 0 & \text{otherwise} \end{cases}$$