Finding two heavy rocks We have $a_1,a_2,a_3,a_4,a_5$ rocks and know that one of them is heavier, at the same time have $b_1,b_2,b_3,b_4,b_5$ and know that one of them is heavier too. 
We have a scale. We must find $2$ heavier rocks after $3$ weighs. Two heavy rocks have the same weight, light rocks have the same weight too. We can do it in $3$ weights, as $3^3>5\times5$.At first I weight ${a1,a2}$ with ${b1,b2}$, but I can't continue this approach when the result is equal. Please help if you can.
 A: We can reduce the complexity at both ends.
For the last weighing, we can prove that any three cases can be distinguished, so we don't need to worry about the details of the last stage as long as we leave only three cases. Each case is a pair of one $a$ and one $b$. If all three $a$s are the same, we can distinguish the cases by weighing two of the $b$s, and if all three $a$s are different we can distinguish the cases by weighing two of the $a$s; and vice versa. That leaves only cases of the form $a_1b_1$, $a_1b_2$, $a_2b_2$, which we can decide by weighing $a_1$ against $b_2$.
At the other end, as Patrick has already stated, the first weighing has to satisfy stringent requirements. There are $5^2=25$ cases to distinguish by $3^3=27$ possible results of the weighings, so the first weighing has to partition the cases either $9/8/8$ or $9/9/7$. All one-on-one and two-on-two weighings are readily excluded by this criterion.
Here's a solution in three weighings:
First weighing: $a_1, a_2, a_3$ vs. $a_4, b_1, b_2$
Case I: $a_1,a_2,a_3$ are heavier. This is the easy case – the heavy balls are one of $a_1,a_2,a_3$ and one of $b_3,b_4,b_5$; weigh $b_3$ against $b_4$.
Case II: $a_4, b_1, b_2$ are heavier. Weigh $b_1$ against $b_2$, partitioning the $7$ cases $3/2/2$.
Case III: Equality. Weigh $b_1$ against $b_2$, partitioning the $9$ cases $3/3/3$.
Interestingly, we can arrange things so that the second weighing always weighs two $b$ balls against each other; the information from the first weighing is only used to decide which ones.
A: As you say, we can extract at most $27$ bits of information from this system, and we need to discriminate between $25$ possibilities. So at every weighing, we need to get the most possible information.
I haven't got a solution, but I have an answer which does it in four weighings, and it certainly can't be done in $2$ by the above argument.
Four-weighings method
We want to halve the solution space. 
Weigh $a_1, a_2, b_1, b_2, b_3$ against the other weights. There are three cases: 


*

*They come out equal, in which case there is:


*

*one heavy weight among $a_1, a_2$ and one among $b_4, b_5$, OR

*one heavy weight among $a_3, a_4, a_5$ and one among $b_1, b_2, b_3$


*$a_1, a_2, b_1, b_2, b_3$ is heavier than the other side, in which case there is a heavy weight among the $a_1, a_2$ and a heavy weight among $b_1, b_2, b_3$; this is solvable by weighing $a_1$ against $a_2$ and then $b_1$ against $b_2$, taking a total three weighings.

*$a_1, a_2, b_1, b_2, b_3$ is lighter than the other side (which we may solve by a symmetric method to the second bullet point).


To solve the only interesting case, then, we can weigh $a_1$ against $a_2$. (We're still trying to discriminate between $4+9=13$ possibilities, so it will take three weighings to do this, since $13 > 3^2$.)


*

*If one is heavier than the other, we're definitely in the first case and we can weigh $b_4$ against $b_5$ to complete the solution in three weighings.

*If they are of the same weight, then we can weigh $a_3$ against $a_4$ and $b_1$ against $b_2$ to complete the solution in four weighings.



Can it be done in 3?
I don't know, but we can rule out some cases at first: our first weighing cannot be weighing $n$ of the $a$'s against $n$ of the $b$'s, or $n$ of the $a$'s against $n$ more of the $a$'s (wlog we start with $a$ in this case).
If we start by weighing $a_1$ against $a_2$, and they're equal, then we are trying to discriminate between $3\times5 = 15$ possibilities with $3^2 = 9$ bits of information.
If we start by weighing $a_1, a_2$ against $a_3, a_4$, and it turns out that one of $a_1, a_2$ is heavier, then we are trying to discriminate $10$ possibilities with $9$ bits of information.
Similarly if we start by weighing $n$ $a$'s against $n$ $b$'s.
If we start by weighing $a_1$ with $b_1$, and they are equal, then we are discriminating $1+16 = 17$ possibilities with $9$ bits of information; the same happens if we weigh four of the $a$'s with four of the $b$'s.
If we start by weighing $a_1, a_2$ with $b_1, b_2$, and they are equal, we are discriminating $4 + 9 = 13$ possibilities; likewise if $n=3$.
There remains only the possibility that we weigh some of the $a_i$ and some of the $b_i$ together against some more of the others, but there are an awful lot of cases here and I don't think I can be bothered to check them.
