Let be two matrices $ A,B\in\mathcal{M}_2\left( \mathbb{R} \right) $ that don’t commute.

[b]a)[/b] If $ A^3=B^3, $ then $ \text{tr} \left( A^n \right) =\text{tr} \left( B^n \right) ,  $ for all natural numbers $ n. $
[b]b)[/b] If $ A^n\neq B^n $ and $ \text{tr} \left( A^n \right) =\text{tr} \left( B^n \right) , $ for all natural numbers $ n, $ then find some of the matrices $ A,B. $
### Part (a)

1. **Given**: \( A^3 = B^3 \) and \( A, B \in \mathcal{M}_2(\mathbb{R}) \) do not commute.
2. **Objective**: Show that \( \text{tr}(A^n) = \text{tr}(B^n) \) for all natural numbers \( n \).

3. **Characteristic Polynomial**: For any \( 2 \times 2 \) matrix \( A \), the characteristic polynomial is given by:
   \[
   \lambda^2 - \text{tr}(A)\lambda + \det(A) = 0
   \]
   This implies that:
   \[
   A^2 = \text{tr}(A)A - \det(A)I
   \]

4. **Cubing the Matrix**: Using the above relation, we can express \( A^3 \) as:
   \[
   A^3 = A \cdot A^2 = A (\text{tr}(A)A - \det(A)I) = \text{tr}(A)A^2 - \det(A)A
   \]
   Substituting \( A^2 \) again:
   \[
   A^3 = \text{tr}(A)(\text{tr}(A)A - \det(A)I) - \det(A)A = (\text{tr}(A)^2 - \det(A))A - \text{tr}(A)\det(A)I
   \]

5. **Given \( A^3 = B^3 \)**:
   \[
   (\text{tr}(A)^2 - \det(A))A - \text{tr}(A)\det(A)I = (\text{tr}(B)^2 - \det(B))B - \text{tr}(B)\det(B)I
   \]

6. **Commutativity**: Since \( B \) commutes with \( B^3 = A^3 \), it must commute with \( (\text{tr}(A)^2 - \det(A))A \). Given \( A \) and \( B \) do not commute, we must have:
   \[
   \text{tr}(A)^2 - \det(A) = 0 \quad \text{and} \quad \text{tr}(B)^2 - \det(B) = 0
   \]
   Thus:
   \[
   \det(A) = \text{tr}(A)^2 \quad \text{and} \quad \det(B) = \text{tr}(B)^2
   \]

7. **Trace Equality**: Since \( A^3 = B^3 \), we have:
   \[
   (\text{tr}(A)^2 - \det(A))A - \text{tr}(A)\det(A)I = (\text{tr}(B)^2 - \det(B))B - \text{tr}(B)\det(B)I
   \]
   Simplifying, we get:
   \[
   \text{tr}(A)^3 = \text{tr}(B)^3
   \]
   Since we are working over \( \mathbb{R} \), this implies:
   \[
   \text{tr}(A) = \text{tr}(B)
   \]

8. **Trace of Powers**: We also have:
   \[
   \text{tr}(A^2) = \text{tr}(A)^2 - 2\det(A) = -\text{tr}(A)^2
   \]
   Similarly:
   \[
   \text{tr}(B^2) = -\text{tr}(B)^2
   \]
   Thus:
   \[
   \text{tr}(A^2) = \text{tr}(B^2)
   \]

9. **Induction**: For higher powers, using induction, we can show:
   \[
   \text{tr}(A^n) = \alpha_n \text{tr}(A)^n = \alpha_n \text{tr}(B)^n = \text{tr}(B^n)
   \]
   where \( \alpha_n = \pm 1, \pm 2 \).

Thus, we have shown that \( \text{tr}(A^n) = \text{tr}(B^n) \) for all natural numbers \( n \).

### Part (b)

1. **Given**: \( A^n \neq B^n \) and \( \text{tr}(A^n) = \text{tr}(B^n) \) for all natural numbers \( n \).
2. **Objective**: Find some matrices \( A \) and \( B \).

3. **Example Matrices**: Consider the matrices:
   \[
   A = \begin{pmatrix} a & b \\ 0 & d \end{pmatrix}, \quad B = \begin{pmatrix} a & 0 \\ 0 & d \end{pmatrix}
   \]
   where \( a, b, d > 0 \) and \( a \neq d \).

4. **Trace Calculation**: For these matrices:
   \[
   \text{tr}(A) = a + d, \quad \text{tr}(B) = a + d
   \]
   \[
   \text{tr}(A^2) = a^2 + d^2, \quad \text{tr}(B^2) = a^2 + d^2
   \]
   \[
   \text{tr}(A^n) = a^n + d^n, \quad \text{tr}(B^n) = a^n + d^n
   \]

5. **Non-commutativity**: Clearly, \( A \) and \( B \) do not commute since \( b \neq 0 \).

Thus, the matrices \( A = \begin{pmatrix} a & b \\ 0 & d \end{pmatrix} \) and \( B = \begin{pmatrix} a & 0 \\ 0 & d \end{pmatrix} \) satisfy the given conditions.

The final answer is \( \boxed{ A = \begin{pmatrix} a & b \\ 0 & d \end{pmatrix} } \) and \( B = \begin{pmatrix} a & 0 \\ 0 & d \end{pmatrix} \).