In physics, you can say that: $T-m_2 g = m_2 a$
And that $ m_1 g - T = m_1 a$
So this, when combined, should equal:
$a = \frac{m_1}{m_1 + m_2} \cdot g$
How do they arrive at that conclusion? I keep getting:
$2a = \frac{m1-m2}{m1+m2} \cdot g$
In physics, you can say that: $T-m_2 g = m_2 a$
And that $ m_1 g - T = m_1 a$
So this, when combined, should equal:
$a = \frac{m_1}{m_1 + m_2} \cdot g$
How do they arrive at that conclusion? I keep getting:
$2a = \frac{m1-m2}{m1+m2} \cdot g$
On
Let's call the vertical cart Body $1$ and the one moving horizontally Body $2$. If the tension forces do not cause the string to break (and of course ignoring air resistance, friction, et cetera) then the vertical cart, Body $1$, should accelerate downward at the same rate as the horizontal cart, Body $2$, should accelerate to the right. If this wasn't the case, the string would become loose/stretch depending on the case and presumably break (or bunch up). Since we are assuming this is not case, the accelerations are the same. So no need to refer to $a_1$ and $a_2$, we can just call the acceleration of the system $a$. Now let's look at the two bodies, call the tension in the string $T$:
Cart $1$: The cart experiences a force of gravity downward of $m_1g$. However, the tension $T$ resists this and pulls the cart upward. So the net fall force is $m_1g-T$. This must be the carts net force. $$ \begin{align} F&=m_1 a\\ m_1g-T&=m_1a \end{align} $$
Cart $2$: The rope attaching the cart to the other cart pulls it to the right. In fact, this is the only force pulling on the cart. By definition, this force is $T$. So we have $$ \begin{align} F&=m_2a\\ T&=m_2a \end{align} $$
Now how do we find this acceleration? Well, we have two different $T$'s which are the same. We relate them. $$ \begin{align} T&=m_2a \\ T&= m_1g-m_1a \end{align} $$ so that $$ \begin{align} m_2a=m_1g-m_1a \end{align} $$ Now solving for $a$ yields $$ \begin{align} m_2a&=m_1g-m_1a \\ m_2a+m_1 a&=m_1 g \\ a(m_1+m_2)&=m_1 g \\ a&=g \frac{m_1}{m_1+m_2} \end{align} $$ Now the important part is we examine what this means. Notice that if $m_2=0$ or very very small, we have $a\approx g\frac{m_1}{m_1}=g$, so the cart falls as if in free fall, which makes sense if the second cart isn't there or is essentially weightless. Now if $m_1>>m_2$, then $a\approx g\frac{m_1}{m_1}=g$, so the cart will act as though in free fall, which also makes sense if the vertical cart is much much heavier than the other cart (essentially this is the same situation as we just considered). If vertical cart has almost no mass, then $m_1 \approx 0$ and $a\approx \frac{0}{0+m_2}=0$, which makes sense because if the cart essentially isn't there, there is nothing to fall or be accelerated.
Notice there is no case in which the horizontal cart is not pulled to the right and where the vertical cart's fall is stopped by the horizontal cart. Why? This is because we have not considered friction. We can easily add a friction force, $\mu N$, to the horizontal cart and obtain an answer similar to yours. I'll leave this for you to try.
Sorry, I get a different answer again!
Add both equations together giving
$$ m_1g - m_2g = m_2a + m_1a $$
Factorize out the $g$ on the left and the $a$ on the right
$$ g(m_1 - m_2) = a(m_2 + m_1) $$
Divide by $(m_1+m_2)$
$$ a = \frac{m_1 - m_2}{m_1+m_2}g $$