What is the difference between
勉強が終わったとたん、眠くなった。
and
勉強をしたとたん、眠くなった。
What is the difference between
1. 勉強が 終わった とたん、眠くなった。
and
2. 勉強をしたとたん、眠くなった 。
If you want to know if the sentence 2 has a similar meaning of 1 and if it is made from the sentence 1 by omitting the phrase 終わった and adjusting the sentence a little, the answer is yes and no.
とたん means like "the moment ...", "just at the moment", and "just as ...", so the phrase is in good relations with "moment".
If you know this, the sentence 2 could be interpreted in two ways;
one of which is the sentence 1 and the other is the sentence 3 as follows:
- 勉強を始{はじ}めたとたん、眠くなった。
If so, the sentence is ambiguous because it has quite different meanings.
Of course I know 勉強した often means 勉強し終わった, like 食べた means 食べ終わった. But, grammatically 勉強した is the past form of 勉強する, and 勉強する is not necessarily meant to finish studying or finish learning, but it also means the whole act of studying or learning for a certain span of time. And the span of time has not good relations with "moment" as is written in naruto's answer.
With these reasons, although the sentence 2 has the same meaning of 1 to some extent, I don't recommend you to use it as the sentence 1.
勉強が終わったとたん、眠くなった。
This pretty straightforwardly means "The moment I finished studying, I became sleepy."
勉強をしたとたん、眠くなった。
とたん is "the moment ~", and 勉強 is an action that takes some time (typically more than an hour). I wouldn't say this sentence is wrong, but I feel this one is a bit clumsy and ambiguous. Anyway it's probably taken as "The moment I started studying, I became sleepy."