Give a grammar for words whose number of $a$'s modulo 2 is larger than whose number of $b$'s modulo 2
I know that the only words that do not belong in $A4$ are the words where the number of $b$'s is odd and the number of $a$'s is even.


This characterization of words not in $A4$ is nice. However, what we want is to produce words in $A$. Let us classify the words in $A4$ as the disjoint union of the following 3 pieces.


the words where the number of $a$'s is even and the number of $b$'s is even.
the words where the number of $a$'s is odd and the number of $b$'s is even.
the words where the number of $a$'s is odd and the number of $b$'s is odd.


Now use a distinct nonterminal to represent each piece.

The above hint should be enough to set you moving.

Once you have got your own solution, or you run into another bottleneck, you could mouseover the following to reveal the spoiler.


   To facilitate writing the grammar, we will add a non-terminal to represent the 4-th piece.

 $\quad$4. the words where the number of $a$'s is even and the number of $b$'s is odd.

 Here is the grammar, where non-terminal $S_{i,j}$ represents the words whose number of $a$'s is $i$ modulo 2 and whose number of $b$'s is $j$ modulo 2.
 

 $S\to S_{0,0}\mid S_{1,0}\mid S_{1,1}$
 $S_{0,0}\to cS_{0,0}\mid aS_{1,0}\mid bS_{0,1}\mid\epsilon $
 $S_{0,1}\to cS_{0,1}\mid aS_{1,1}\mid bS_{0,0}$
 $S_{1,0}\to cS_{1,0}\mid aS_{0,0}\mid bS_{1,1}$
 $S_{1,1}\to cS_{1,1}\mid aS_{0,1}\mid bS_{1,0}$