Grammar for $\{ a^i b^j: j < 2i \text{ and } j \ne i \} $
If $j \neq i$ then either $j &lt; i$ or $j &gt; i$. Hence you can write your language as
$$
\{ a^i b^j : j &lt; i \} \cup \{ a^i b^j : i &lt; j &lt; 2i \}.
$$
It suffices to find a grammar for each of these two languages. Such questions have been asked and answered on this site.