Let's denote the lifespan of the giraffe as \( x \) years. According to the problem:
- The lifespan of the guinea pig is \( x - 6 \) years.
- The lifespan of the tiger is \( 4 \) times that of the guinea pig, which is \( 4(x - 6) \) years.
Now we can write an equation for the total lifespan of the three animals:
\[ x + (x - 6) + 4(x - 6) = 30 \]
Now let's simplify this equation step by step:
\[ x + (x - 6) + 4(x - 6) = 30 \] \[ x + x - 6 + 4x - 24 = 30 \] \[ (1 + 1 + 4)x - 30 = 30 \] \[ 6x - 30 = 30 \] Add \( 30 \) to both sides:
\[ 6x = 60 \] Now, divide by 6:
\[ x = 10 \]
Thus, the lifespan of the giraffe is \( \boxed{10} \) years.
To verify:
- Lifespan of the giraffe: \( 10 \) years.
- Lifespan of the guinea pig: \( 10 - 6 = 4 \) years.
- Lifespan of the tiger: \( 4 \times 4 = 16 \) years.
Now, calculating the total lifespan:
\[ 10 + 4 + 16 = 30 \]
The total is indeed \( 30 \) years, confirming that our solution is correct. The longevity for the giraffe is \( \boxed{10} \) years.