Don't use $$, it's plain-TeX syntax and does not have the flexibility, for example, to move the equations automatically to the left.
Don't use $$, ...
Don't use $$, ...
The formatting of $$ is hard-coded in TeX, thus to change its behavior for automatic left-aligning, the source code of TeX needs to be changed.
With extra TeX code, also $$...$$ can be left aligned, but then it's cleaner to use the correct markup in the first place, where options like fleqn just work.
A. Package varwidth. Environment varwidth puts its contents into a minipage unpacks it and shrinks the contents to the maximal needed width:
\documentclass{article}
\usepackage{dsfont}
\usepackage{varwidth}
\usepackage{lipsum}
\begin{document}
\lipsum[101]
\noindent
\begin{varwidth}{\linewidth}
$$
f(x) = \frac{\sin^2x \, \cos x}{\sin x + \cos x} -
\frac{1}{4}\tan (\frac{\pi }{4} - x)
\quad\forall x \in\mathds{R}
\setminus \left\{ n\pi - \frac{\pi}{4}, n\pi + \frac{\pi}{2} \right\}, n \in \mathds{I}
$$
\end{varwidth}
\end{document}

The vertical spacing needs some manual fixing.
B. If the equation starts with a glue, then TeX respects this glue setting assuming the user knows, what he is using.
\documentclass{article}
\usepackage{dsfont}
\usepackage{varwidth}
\usepackage{lipsum}
\begin{document}
\lipsum*[101]
$$
\hspace{0pt minus \linewidth}
f(x) = \frac{\sin^2x \, \cos x}{\sin x + \cos x} -
\frac{1}{4}\tan (\frac{\pi }{4} - x)
\quad\forall x \in\mathds{R}
\setminus \left\{ n\pi - \frac{\pi}{4}, n\pi + \frac{\pi}{2} \right\}, n \in \mathds{I}
\hspace{\linewidth minus -1fil}
$$
\end{document}

The trick is based on the second \hspace with \linewidth, which forces an overfull equation. Then TeX will contribute the shrink parts, moving to the left in the first \hspace and filling the right with minus -1fil of the second \hspace.
\[ … \]preferable to$$ … $$? – Heiko Oberdiek May 27 '15 at 09:42! Missing [sic] insertedI would'ntgo that far <to be read again>– 1010011010 May 27 '15 at 10:30\fracis a latex construct. – barbara beeton May 27 '15 at 13:13