It's a weighted average problem
Let x be the original quantity. The original quantity is 85% chemical, so the amount of chemical at the start is 0.85x
Let y be the portion that was replaced. When y is removed from a solution of 85% chemical, the amount of chemical removed is 0.85y. At this point, the amount of chemical in the solution is 0.85x-0.85y
An equal amount is replaced, so y is then added back in. However, the portion added is only 20% chemical, so the amount of chemical added back in is 0.20y. After the replacement, the amount of chemical in the solution is 0.85x-0.85y+0.20y
We're told that as a result of this replacement, the final solution is 40% chemical. Furthermore, since an equal portion (y) was removed and replaced, the final quantity is also the original quantity (x). So the amount of chemical in the final solution is 0.40x
Thus we've found that the amount of chemical in the final solution is 0.85x-0.85y+0.20y, but it also equals 0.40x. Put that in an equation
0.85x-0.85y+0.20y=0.40x
We want to find the part of the original that was replaced. I suggest the answers are in fractions (or maybe percentages). The quantity replaced is y, so as a fraction of the total, the part replaced is y/x. That's what we should solve for.
Subtract 0.40x from both sides: 0.45x-0.85y+0.20y=0
Merge the ys: 0.45x-0.65y=0
Isolate x from y 0.45x=0.65y
Divide both sides by x 0.45=0.65y/x
Divide both sides by 0.65 0.45/0.65=y/x
Simplify 9/13=y/x