Q:

Missing $ inserted when there are exactly one $ at beginning and end

I get a weird error but I don't seem to do anything wrong. 
Here is my code:
\documentclass{article}
\usepackage{mathtools}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes,fit}

\begin{document}

\begin{tikzpicture}[remember picture]
    \node{$\tikznode{n9}{9}+\tikznode{n7}{7}=\tikznode[boxed]{n16}{\phantom{\frac{10}{20}}}$};
    \node[boxed,above left=2mm and 2mm of n7] (n1) {\phantom{10}};
    \node[boxed,above right=2mm and 2mm of n7] (n6) {\phantom{10}};
    \node[boxed,above=13mm of n7] (n10) {\phantom{10}};
    \draw[shrt] (n1) -- (n7);
    \draw[shrt] (n6) -- (n7);
    \draw[shrt] (n10.south east) -- (n6);
    \node[ellipse,draw,fit=(n1) (n9),inner sep=1pt] (n1n9) {};
    \draw[shrt] ([x-]n10.south west) -- ([x-]n1n9.north);
    \draw[shrt] ([x+]n10.south west) -- ([x+]n1n9.north);
\end{tikzpicture}
\end{document}

On the 9th line, ie., 
\node{$\tikznode{n9}{9}+\tikznode{n7}{7}=\tikznode[boxed]{n16}{\phantom{\frac{10}{20}}}$};

it says Missing $ inserted but I swear this is correct. 

A:

You have to use $ ... $ for \frac -> \phantom{$\frac{...}{...}$}}. 
MWE compledted with your definitions here. 
Modifications:
\node{$\tikznode{n9}{9}+\tikznode{n7}{7}=\tikznode[boxed]{n16}{\phantom{$\frac{10}{20}$}}$};

MWE:
\documentclass{article}
\usepackage{mathtools}% not necessary here
\usepackage{tikz}

\usetikzlibrary{positioning,shapes,fit}
\newcommand\tikznode[3][]%
   {\tikz[baseline=(#2.base)]
      \node[minimum size=0pt,inner sep=0pt,#1](#2){#3};%
   }
\tikzset
   {boxed/.style={draw,minimum size=0pt,inner sep=1pt},
    shrt/.style={shorten >=1pt, shorten <=1pt},
    x-/.style={xshift=-0.5pt},
    x+/.style={xshift=0.5pt}
   }

\begin{document}
\begin{tikzpicture}[remember picture]
    \node{$\tikznode{n9}{9}+\tikznode{n7}{7}=\tikznode[boxed]{n16}{\phantom{$\frac{10}{20}$}}$};
    \node[boxed,above left=2mm and 2mm of n7] (n1) {\phantom{10}};
    \node[boxed,above right=2mm and 2mm of n7] (n6) {\phantom{10}};
    \node[boxed,above=13mm of n7] (n10) {\phantom{10}};
    \draw[shrt] (n1) -- (n7);
    \draw[shrt] (n6) -- (n7);
    \draw[shrt] (n10.south east) -- (n6);
    \node[ellipse,draw,fit=(n1) (n9),inner sep=1pt] (n1n9) {};
    \draw[shrt] ([x-]n10.south west) -- ([x-]n1n9.north);
    \draw[shrt] ([x+]n10.south west) -- ([x+]n1n9.north);
\end{tikzpicture}
\end{document}

