If $x$ is real, $x\ge 1$, let $\varphi(x,n)$ denote the number of positive integers less than or equal to $x$ that are relatively prime to $n$. Prove that $$\varphi(x,n)=\sum_{d|n}\mu(d)\left\lfloor\frac xd\right\rfloor$$ and $$\sum_{d|n}\varphi\left(\frac xd,\frac nd\right)=\lfloor x\rfloor$$
Since it is clear that $\varphi(n,n)=\varphi(n)$, we can put $x=n$ and check that the identities indeed work.
I guess, the first one will somehow require writing $\varphi(n)$ as a sum over the $x$'s of $\varphi(x,n)$. And once the first one is done, I guess the second one will somehow follow from Möbius inversion formula. But, I am not sure about either. I also couldn't make any more progress.
As I mentioned in the comments, the duplicate question mentioned doesn't have a proper complete answer. In particular, none of the two answers has a proof for the second identity. I really want a complete proof of that.
Use the identity
$$ \sum_{d|n}\mu(d)= \begin{cases} 1 & n=1 \\ 0 & n>1 \end{cases} $$
so that
$$ \varphi(x,n)=\sum_{\substack{k\le x\\(k,n)=1}}1=\sum_{k\le x}\sum_{d|(n,k)}\mu(d)=\sum_{d|n}\mu(d)\sum_{\substack{k\le x\\d|k}}1=\sum_{d|n}\mu(d)\left\lfloor\frac xd\right\rfloor. $$
Applying Möbius inversion for general convolutions to the right hand side shall give the second identity.