\documentclass[12pt]{article}

\usepackage{amsmath}
\usepackage{amssymb}

\usepackage{xcolor}

%\usepackage{systeme}

%\usepackage[textheight=8.5in, margin=1.6in]{geometry}
\usepackage[total={6in,8in}]{geometry}

\usepackage{tikz}
%\usepackage{pgfplots}
%\tikzstyle{ball} = [circle,shading=ball, ball color=black,
%    minimum size=1mm,inner sep=1.3pt]
%\usetikzlibrary{arrows.meta}
%\tikzset{>={Latex[length=2mm,width=1.5mm]}}

%\usepackage{graphicx}

\usepackage{needspace}  % <-- to prevent bad pagebreak over environment titles
% Use:  \Needspace{3\baselineskip} before opening an environment

\usepackage{enumitem}
%\setlist[enumerate]{leftmargin=*}

\allowdisplaybreaks

%\usepackage[colorlinks=true,citecolor=black,linkcolor=black,urlcolor=blue]{hyperref}

\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\W}{\mathbb{W}}
\newcommand{\sn}{\mathfrak{S}}
\newcommand{\ve}{\varepsilon}
\newcommand{\ips}[2]{\langle{#1}, {#2}\rangle}
\newcommand{\incid}{\mathcal{I}(P)}
\DeclareMathOperator{\tr}{tr}
\DeclareMathOperator{\Span}{\mathrm{Span}}
\DeclareMathOperator{\rk}{\mathrm{rank}}
\DeclareMathOperator{\trace}{\mathrm{tr}}
\DeclareMathOperator{\im}{\mathrm{im}}
\DeclareMathOperator{\Sym}{\mathrm{Sym}}
\DeclareMathOperator{\Hom}{\mathrm{Hom}}
\DeclareMathOperator{\diag}{\mathrm{diag}}
\DeclareMathOperator{\glb}{\mathrm{glb}}
\DeclareMathOperator{\lub}{\mathrm{lub}}

\parskip = 0.05in
\parindent = 0.0in

%\pagestyle{empty}

\begin{document}
\centerline{Math 372 lecture for Friday, Week 8}
\bigskip

\centerline{\bf M\"obius inversion examples}
\bigskip

We first recall a few things from the last lecture.
\medskip

{\bf M\"obius inversion.} If~$P$ is finite and~$f,g\colon P\to K$, then
\begin{align*}
  g(t)&= \sum_{s:s\leq t}f(s)\quad\forall t\in P
  \quad\Leftrightarrow\quad
  f(t)=\sum_{s:s\leq t}\mu(s,t)g(s)\quad\forall t\in P\\[8pt]
  g(t)&= \sum_{s:s\geq t}f(s)\quad\forall t\in P
  \quad\Leftrightarrow\quad
  f(t)=\sum_{s:s\geq t}\mu(t,s)g(s)\quad\forall t\in P.
\end{align*}
\smallskip

{\bf Product posets.}  If~$P,Q$ are posets, then~$P\times Q$ is a poset with
\[
(p,q)\leq (p',q')\quad\Leftrightarrow\quad p\leq q\ \text{ and }\ p'\leq q'.
\]
and
\[
  \mu_{P\times Q}( (p,q),(p',q'))=\mu_P(p,p')\mu_Q(q,q').
\]

{\bf Boolean poset.}  We saw that~$B_n\simeq\mathbf{2}^n$ as posets and used the
product rule to show
\[
  \mu_{B_n}(T,S) = (-1)^{|S|-|T|}
\]
for all~$T\subseteq S\subseteq[n]$.

{\bf Principle of inclusion-exclusion.} As a special case of M\"obius inversion
for~$B_n$ we showed that if
~$A_1,\dots,A_n$ are subsets of some finite
set~$A$, then
\[
  |A_1\cup\dots\cup A_n|=
\sum_{i}|A_i|-\sum_{i<j}|A_i\cap A_j|+\sum_{i<j<k}|A_i\cap A_j\cap A_k|
+\dots+(-1)^{n-1}|A_1\cap\dots\cap A_n|.
\]

We now give a couple more applications of M\"obius inversion.
\medskip

{\bf Derangements revisited.} For each~$S\subseteq[n]$,
let~$f(S)$ be the number of elements $\pi\in\mathfrak{S}_n$ whose set of fixed
points is exactly~$S$:
\[
  f(S)=|\left\{ \pi\in\mathfrak{S}_n:\pi(i)=i \text{ iff } i\in S \right\}|,
\]
and let~$g(S)$ be the number of elements~$\pi\in\mathfrak{S}_n$ whose set of
fixed points includes~$S$:
\[
  g(S) = |\left\{ \pi\in\mathfrak{S}_n:\pi(i)=i\text{ for all } i\in S \right\}|.
\]
An easy counting argument and M\"obius inversion then gives the number of
derangments~$D_n$:
\begin{align*}
  D_n&= f(\emptyset)\\
  &= \sum_{T:\emptyset\subset T}(-1)^{|T|}g(T)\\
  &= \sum_{T:\emptyset\subset T}(-1)^{|T|}(n-|T|)!\\
  &= \sum_{i=1}^{n}\sum_{|T|=i}(-1)^{i}(n-i)!\\
  &= \sum_{i=1}^{n}(-1)^{i}\binom{n}{i}(n-i)!\\
  &= n!\sum_{i=1}^{n}\frac{(-1)^{i}}{i!}.
\end{align*}
Thus,
\[
  \frac{D_n}{n!}=\sum_{i=1}^{n}\frac{(-1)^{i}}{i!}=1-1+\frac{1}{2}-\frac{1}{3!}+\dots+\frac{(-1)^n}{n!}.
\]
{\em A curiosity.}  What is the probability that a random
function~$f\colon[n] \to [n]$ has no fixed points?  To answer this, note
that to create a such a function, the only restriction is that~$f(i)\in[n]
\setminus\left\{ i \right\}$ for each~$i$.  Hence, for each~$i$ there
are~$(n-1)$ choices for~$f(i)$.  This means the total number of such functions
is~$(n-1)^n$.  The total number of functions~$[n] \to[n]$ with no restrictions
is~$n^n$.  Thus, the probability we are looking for is
\[
  \frac{(n-1)^n}{n^n}=\left(1-\frac{1}{n}\right)^n.
\]
As~$n\to\infty$, we have
\[
  \left(1-\frac{1}{n}\right)^n\to \frac{1}{e}.
\]
\medskip

{\bf Divisibility poset.}  Let~$\W:=\Z_{>0}=\left\{ 1,2,\dots \right\}$,
the set of positive integers with a poset structure defined by divisibility:
for~$a,b\in\W$, let~$a\leq b$ if~$a|b$, i.e., if there exists an
integer~$k$ such that~$b=ka$.  

Given~$n\in\W$ consider the interval~$[1,n]$ as a subposet of~$\W$.  The
M\"obius function of~$[1,n]$ is equal to the M\"obius function of~$\W$
restricted to~$[1,n]$. M\"obius inversion applied to $[1,d]\subset\W$ says that
for~$f,g\colon [1,d]\to K$, 
\[
  f(n)=\sum_{d:d|n}g(d)
  \quad
  \Leftrightarrow
  \quad
  g(n) = \sum_{d:d|n}\mu_{\W}(d,n)f(d).
\]
Our goal now is to find a formula for~$\mu_{\W}$.    Factor~$n$ into primes:
$n=\prod_{i=1}^kp_i^{e_i}$ where each~$p_i$ is a prime number and each~$e_i$ is
a positive integer.  Then~$a\in[1,n]$ if and only if $a|n$, which is equivalent
to saying $a=\prod_{i=1}^kp_i^{f_i}$ where~$0\leq f_i\leq e_i$ for~$i=1,\dots,k$.
Thus, there is an isomorphism of posets
\begin{align*}
  \W\supset[1,n] &\xrightarrow{\sim} \left\{ 0,1,\dots,e_1
  \right\}\times\cdots\times\left\{ 0,1,\dots,e_k \right\}\\
  a=\prod_{i=1}^kp_i^{f_i}&\mapsto(f_1,\dots,f_k),
\end{align*}
where each~$\left\{ 0,1,\dots,e_i \right\}$ is a subset of~$\N$ with the {\em
usual} ordering of natural numbers.  Recall that
\[
  \mu_{\N}(i,j)=
  \begin{cases}
    \hfill1\hfill&\text{if~$j=i$}\\
    -1&\text{if~$j=i+1$}\\
    \hfill0\hfill&\text{if~$j>i+1$}.
  \end{cases}
\]
Suppose that~$d=\prod_{i=1}^kp_i^{d_i}$.  Using the above isomorphism, we identify~$[d,n]$ with a product poset and compute
\[
  \mu_{\W}(d,n)=\prod_{i=1}^k\mu_{\N}(d_i,e_i)=
  \begin{cases}
    \hfill0\hfill&\text{if~$e_i-d_i>1$ for some~$i$,}\\
    \hfill(-1)^{\ell}&\text{where~$\ell=|\left\{ i:e_i-d_i=1 \right\}|$,}\\
    \hfill1\hfill&\text{if~$e_{i}=d_{i}$}.
  \end{cases}
\]

When we were discussing Dirichlet series, we defined the M\"obius
function $\mu\colon\Z_{>0}\to\left\{ -1,0,1 \right\}$ as the unique
multiplicative function such that
\[
  \mu(p^{e})=
  \begin{cases}
    1&\text{if~$e=0$}\\
    -1&\text{if~$e=1$}\\
    0&\text{if~$e>0$}
  \end{cases}
\]
for each prime~$p$ and~$e\geq0$. We see that
\[
  \mu\left( \dfrac{n}{d} \right)
  =\mu\left(\, \prod_{i=1}^kp_i^{e_i-d_i} \right)
  =\prod_{i=1}^k\mu\left(\, p_i^{e_i-d_i} \right)
  =\mu_{\W}(d,n).
\]
M\"obius inversion on the poset~$\W$ thus recovers the classical M\"obius
inversion formula: if $f(n)=\sum_{d:d|n}g(d)$, then
\[
  g(n)=\sum_{d:d|n}\mu_W(d,n)f(d)=\sum_{d:d|n}\mu\left( \dfrac{n}{d}
  \right)f(d).
\]
\end{document}
