Answer
Case A:
(a) $P=2.9N$
(b) $a=0.97m/s^2$
Case B:
(a) $P=3.87N$
(b) $a=0.64m/s^2$
Work Step by Step
Let's analyze the forces acting on the boxes.
For box 1, there is only the reaction force from box 2 as box 1 exerts pushing force $P$ on box 2. This force has the same magnitude but opposite direction compared to $P$, so we call it $-P$.
Box 1 moves with acceleration $a$, so $$-P=m_1a$$
For box 2, box 1 exerts pushing force $P$ in the direction of the motion. Kinetic friction $f_k$ opposes this motion. Box 2 moves with similar $a$, so $$P-f_k=m_2a$$ $$P-5.8=m_2a$$
In each case, we apply $m_1$ and $m_2$ to these 2 equations and solve for $P$ and $a$, which are the answers to the exercise.
(a) $m_1=m_2=3kg$
We have $-P=3a$ and $P-5.8=3a$
Solving equations, we have $a=-0.97m/s^2$ and $P=2.9N$
Magnitude is never negative, so magnitude of $a=0.97m/s^2$
(b) $m_1=6kg$ and $m_2=3kg$
We have $-P=6a$ and $P-5.8=3a$
Solving equations, we have $a=-0.64m/s^2$ and $P=3.87N$
Magnitude is never negative, so magnitude of $a=0.64m/s^2$