What is the number of one-to-one functions $f$ from the set $\{1,2,...,n\}$ to the set $\{1,2,...,2n\}$ so that $f(x) \neq x$ and $f(x) \neq 2n - x + 1$ for all $x$?
I'm getting that the number of such functions is total number of one-to-one functions here (which is $(2n)!/n!$) - $|A_1 \cup A_2 \cup \ldots \cup A_n|$ where $A_i$ is the set of one-to-one functions such that $f(x)=x$ or $f(x)=2n-x+1$ for some $x$.
Where do I go from there?
I’ll work this one out in detail to give you a model for similar problems.
As usual, $[n]=\{1,2,\ldots,n\}$. The inclusion-exclusion principle says that
$$\left|\bigcup_{k=1}^nA_k\right|=\sum_{\varnothing\ne I\subseteq[n]}(-1)^{|I|+1}\left|\bigcap_{k\in I}A_k\right|\;,$$
so the first step is to figure out what $\left|\bigcap_{k\in I}A_k\right|$ is for an arbitrary non-empty subset $I$ of $[n]$.
Clearly
$$|A_k|=\frac{2(2n-1)!}{n!}$$
for each $k\in[n]$: there are $2$ choices for $f(k)$ and $\frac{(2n-1)!}{n!}$ for the rest of $f$. More generally, suppose that $\varnothing\ne I\subseteq[n]$. There are $2$ choices for $f(k)$ for each $k\in I$, so
$$\left|\bigcap_{k\in I}A_k\right|=\frac{2^{|I|}(2n-|I|)!}{n!}\;,$$
and therefore
$$\begin{align*} \left|\bigcup_{k=1}^nA_k\right|&=\sum_{\varnothing\ne I\subseteq[n]}(-1)^{|I|+1}\frac{2^{|I|}(2n-|I|)!}{n!}\\ &=\sum_{k=1}^n\binom{n}k(-1)^{k+1}\frac{2^k(2n-k)!}{n!}\\ &=\frac1{n!}\sum_{k=1}^n\binom{n}k(-1)^{k+1}2^k(2n-k)!\;. \end{align*}$$
Thus, the total number of functions with the desired properties is
$$\begin{align*} \frac{(2n)!}{n!}-\frac1{n!}\sum_{k=1}^n\binom{n}k(-1)^{k+1}2^k(2n-k)!&=\frac{(2n)!}{n!}+\frac1{n!}\sum_{k=1}^n\binom{n}k(-1)^k2^k(2n-k)!\\ &=\frac1{n!}\sum_{k=0}^n\binom{n}k(-1)^k2^k(2n-k)!\;. \end{align*}$$