Let A be the number of Aliyah's cookies and R be the number of Raina's cookies.
A + R = 84 which we can use to eliminate A or R by rearranging
A = 3R - 6 means " A is 6 less than 3R"
Let's substitue 84-R for A
84-R = 3R - 6 Add R to both sides, add 6 to both sides
90 = 4R Divide by 4
R = 22.5 and A is 84-22.5 = 61.5 So this answer is not reasonable (whole cookies only).. So, either the problem is badly posed or the wording isn't quite what you wrote.
The 84 cookies could be R or could be A. Then the problem is not as difficult. Now you just plug into the A = 3R-6 equation. You will get a whole number.