Harry Potter answers

To summarize the problem: Three bottles of poison, two bottles of wine, one potion that lets you go backwards, one that lets you go forwards.
Clue 1: Wine always has poison to the left.
Clue 2: The two ends are different, and neither is the potion that lets you go forward.
Clue 3: The largest and smallest bottles do not contain poison.
Clue 4: The second from the left and the second from the right are the same.

Let us number the potions 1-7 starting on the left. According to Clue 4, potion 2 is the same as potion 6. Since there's only one potion that lets you go forward and one that lets you go backward, 2 and 6 are either both poison or both wine. If they're both wine, then by Clue 1, potions 1 and 5 are poison. Thus, we have two possibilities:
?P???P?
PW??PW?

Adding the third poison bottle in all its possible positions, we get the following possibilities:
A. PP???P?
B. ?PP??P?
C. ?P?P?P?
D. ?P??PP?
E. ?P???PP
F. PWP?PW?
G. PW?PPW?
H. PW??PWP

Option H is eliminated by Clue 2, as potions 1 and 7 are the same.

Also by Clue 2, we know that potions 1 and 7 are unhelpful - that is, they can only be poison, wine, or the potion that lets you go backward. All the poison is already displayed in the above options, and potion 1 can never be wine because there's no position to the left of it for the poison mandated by Clue 1. Thus, in options B, C, D, and E, potion 1 must be the backward potion. This leaves only wine for position 7 in B, C, and D. In options F and G, all the poison and wine is already displayed, so potion 7 must be the backward potion.
A. PP???P?
B. BPP??PW
C. BP?P?PW
D. BP??PPW
E. BP???PP
F. PWP?PWB
G. PW?PPWB

We can fill in the rest of the wine in A, C, and D from the constraint of Clue 1, that wine always has poison to the left of it. E cannot comply with this, and can be eliminated. C is still ambiguous, with two possible positions for the remaining wine.
A. PPW??PW
B. BPPW?PW
C. BP?P?PW
D. BPW?PPW
F. PWP?PWB
G. PW?PPWB

This is about as far as we can go without Hermione's help. All of the remaining options can satisfy the clues we were given. In B, D, F, and G, there is only one spot left for the potion that lets you advance through the fire. But in A and C, there are two spots. In A, potions 4 and 5 can be either the forward potion or the backward potion. In C, potions 3 and 5 can be either the forward potion or wine. In neither of these two cases will knowledge of the sizes of the bottles help; the only thing we can tell from that is whether or not a bottle contains poison.

But Hermione was able to solve the problem, so she must have been able to eliminate options A and C. Since A and C comply with Clues 1, 2, and 4 regardless of how you fill in the ambiguous positions, she must have eliminated them using Clue 3, that the largest and smallest bottles do not contain poison. Thus, both A and C must contain poison in positions where Hermione could see the largest or smallest bottle. We can break this into two cases:

Case 1: Potions 1 and 4 have largest and smallest bottles (not necessarily respectively). In this case, not just A and C, but F and G are eliminated as well, leaving B and D as possibilities. But B and D both comply with the clues, and have the correct potion in different positions, so in this case, Hermione would not have been able to solve the problem.

Case 2: Potion 2 or 6 (either one) has the largest or smallest bottle. In this case, A, B, C, and D are eliminated. F and G remain. As in the previous case, the remaining options have the correct potion in different positions, but there remains one guaranteed-poison-free bottle (largest or smallest) whose position has not been determined. If it's potion 3, G is eliminated. If it's potion 4, F is eliminated. (If it's potion 2, 6, or 7, Hermione would be unable to solve the problem, so it must be in position 3 or 4.)

We still don't know whether the correct potion (in the smallest bottle, according to Hermione) is in position 3 or 4, but we do know that option F or G is correct. In both of these options, the backward potion is in position 7. And we don't know whether the largest potion is in position 2 or 6, but in F and G, both of these positions contain wine. Thus, the largest bottle contains wine, and the potion that lets you go backwards is on the right end.

(In the book, Hermione goes on to correctly state that the backward potion is on the right end.)