I am working with ternary expansions for the first time and I do not understand why the expansion shifts left by two positions when one takes $1-x$ with $x \in (0,1)$. We write $x'$ for the ternary expansion of $x$.
I try to illustrate what I mean by the following examples:
if $x = 0.2$, then $x'= 0.01210121012101210121$
if $ = 0.8$, then $x'= 0.21012101210121012101$
if $x = 0.3$, then $x'= 0.0220022002200220022$
if $ = 0.7$, then $x'= 0.20022002200220022002$
if $x = 0.4$, then $x'= 0.10121012101210121012$
if $ = 0.6$, then $x'= 0.1210121012101210121$
Now I do not see why this is the case. If we write $x = .a_{1}a_{2}a_{3}... = \frac{a_{1}}{3} + \frac{a_{2}}{3^{2}} + \frac{a_{3}}{3^{3}} + ... $,
I do not see the relationship with $1-x$.
This is a coincidence because of the values of $x$ you are choosing. To illustrate my point, take $x=\frac{1}{\pi}$. The ternary expansion of $x$ begins: $$0.022121001021..._3$$ And so the ternary expansion of $1-x$ begins: $$0.200101221201..._3$$ As you can see, this is not a shift of the original sequence by $2$ digits (it can't be or else we would have a proof that $\pi$ is rational!). Rather the $0$s have been replaced by $2$s, and vice versa. That is actually what you are observing in each of your examples.
The reason this looks like a shift is because you chose repeating ternary expansions with particular patterns. Notice that even choosing $x=\frac{1}{4}$ breaks your observation because its ternary expansion ($0.02020202..._3$) has a period of $2$.
Now you might wonder, how come taking $1-x$ swaps all the $0$s and $2$s? Let's write $x=0.a_1a_2a_3..._3$ as you did, and let $y = b_1b_2b_3..._3$ where $$b_n = \begin{cases}0 & \text{if } a_n = 2\\ 1 & \text{if } a_n = 1 \\ 2 & \text{if } a_n = 0. \end{cases}$$ So $y$ the result of swapping the $0$s and $2$s in $x$. Then notice that $a_n+b_n = 2$ always. Hence, adding $x$ and $y$ digit-by-digit, we get $$x+y = 0.22222..._3=1.$$ Thus we must have $y=1-x$.
Note that a similar behavior occurs with decimal expansions, except instead of swapping $0$s and $2$s, we swap each digit $i$ with $9-i$. For instance, since $\frac{1}{\pi} = 0.318309886183...$, we have $1-\frac{1}{\pi} = 0.681690113816...$, and so adding them we get $0.99999\cdots = 1$. In ternary, we are instead swapping each digit $i$ with $2-i$, which has the effect of turning $0$ into $2$ and vice versa, while leaving the $1$s alone.