I am trying to replicate the same exact output as plain math mode would give
for a simple polynomial formula but using \matrix because I want to
right-align the terms in the polynomial or leave some of them blank. I can't use \alignat either for other reasons.

I have made some progress but the spacing is hard to get right. In the
following picture you can see the output in plain math mode, using
\alignat and my attempt using \matrix (I use the convenience macro
\arr).

As you can see, my version is somewhat off. I think the biggest error
is in the spacing around the equals sign.

I didn't know about tabular stack but it seems to do exactly what I want.
– Ernest AApr 22 '15 at 17:38

@ErnestA Great! Glad to hear that my package can help you. I should add that the \TABbinary essentially places a {} before and after each tabbed field, so that you don't have to add them manually as in {}+{}, etc. There are other options that only auto-adds the {} to the left or the right of the field.
– Steven B. SegletesApr 22 '15 at 18:00