• it is impossible to tell without an example but note that the space around displays can stretch or shrink. If you are using a document class that uses \flushbottom this vertical space can change to ensure equal page lengths just as inter-word space changes on a line to maintain equal line lengths – David Carlisle May 28 '20 at 14:52
• Ohk fine. Let me write some code snippets. – Kolmogorov May 28 '20 at 14:57
• code snippets are not "a small complete example". But don't use empty lines around display math. This math belongs to the paragraph. – Ulrike Fischer May 28 '20 at 15:09
• Your code contains an empty line, which generates a paragraph break, before the first instance of $$...$$ but not before the second. The iron rule of TeX and LaTeX says: never, ever, permit a paragraph break before starting a display-math group. – Mico May 28 '20 at 15:23

You claim,

in both the cases, I've written the codes in the exact similar manner. But why are the vertical spacings different for the two cases?

In fact, there is a crucial difference between the ways you wrote the two instances of $$...$$: In the former there's a blank line right before $$...$$, whereas in the latter there's not.

Blank lines in TeX and LaTeX documents trigger a paragraph break. There is an Iron Rule in TeX and LaTeX: Never, ever place a paragraph break immediately before a displaymath entity -- be this $$...$$, $...$, $$...$$, or what have you. Taking out the blank line immediately improves the spacing situation.

An MWE (minimum working example) that's based on your code fragment:

For the second case, I also removed all the ~ spacers.

\documentclass[a4paper,15pt]{scrartcl}
\usepackage{mathtools} % for '\DeclarePairedDelimiter' macro
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}

\begin{document}
\subsubsection*{With the spurious blank line}

\dots where $\mathbf{R}_2\vec{x}=\vec{0}$ as
$\mathbf{R}_2$ is a zero matrix. So, now we have

$\norm{\mathbf{R}\vec{x}-\mathbf{Q}'\vec{b}}^2~ =~\norm{\mathbf{R}_1\vec{x}-\mathbf{c}_1}^2~+~\norm{-\mathbf{c}_2}^2~ =~\norm{\mathbf{R}_1\vec{x}-\mathbf{c}_1}^2~+~\norm{\mathbf{c}_2}^2$

\subsubsection*{Without the spurious blank line}

\dots where $\mathbf{R}_2\vec{x}=\vec{0}$ as
$\mathbf{R}_2$ is a zero matrix. So, now we have
$\norm{\mathbf{R}\vec{x}-\mathbf{Q}'\vec{b}}^2 =\norm{\mathbf{R}_1\vec{x}-\mathbf{c}_1}^2+\norm{-\mathbf{c}_2}^2 =\norm{\mathbf{R}_1\vec{x}-\mathbf{c}_1}^2+\norm{\mathbf{c}_2}^2$
\end{document}

• Thank you. It really helped. :) – Kolmogorov May 28 '20 at 16:17