how do i "underline" x with a tilde (the ~ symbol)?
This is not easy in TeX. Part of the problem is that the tilde is a reserved character in TeX, which means that it is very hard to display it (except through the \tilde command, which produces an accent above a letter). The only way I can get it to appear underneath a character is to use Plato's idea in the previous comment, which produces something similar to a tilde by using the \sim symbol. The difficulty then is to get it to appear under an x, without raising the x, and without looking too big or too far underneath the x. The best I can manage is
[TEX]a \underset{^\sim}x b[/TEX]
which produces
.
Even then, the tilde is a long way below the x. I think you would probably do better to use an alternative notation.