One of the master's student is working on a research problem. I am a PhD student. I have an idea which I proposed to my advisor on the same problem. Now he wants me and the masters student to work on that idea and publish a paper. Would I be treated as a first author in that paper or would I be a second author?
You give a partial version of the story using pejoratives instead of trying to stay based on facts. So it is difficult to answer your question with that information.
What we can say is that authorship is something to be discussed with your advisor. It will be his decision, in the end. A good way to help yourself is to work hard on that idea, and clearly make your point. The best way to help yourself be first author is to write the paper, or at least the more significant portions of it! Start already with introduction and methods, and as soon as results are gathered, write it up and then submit it to your advisor. If you have done a large part of the work and wrote the manuscript, you should have no problem being first author.
A PhD student insisting on being the first author on a master project is something not welcoming sometimes. Specially if the master student understands the problem and she can solve it by herself. In this case, unless you will bring a new major perspective to the solving method, you won't be the first author.
I have worked with master students and my role was very clear from the beginning. I was involved either as
- supporter to the master student
(i.e. checking the literature, suggesting improvements, studying the problem, brainstorming for better ideas, help with writing)
- the master student is supporter for me
(i.e. doing code implementation, graphic design..etc).
If the research problem is the student thesis, then most likely you will not be the first author (it is the student thesis, right?)
The authorship thing is the supervisor responsibility. If you are very concerned about it (i.e. you wouldn't work unless you are the first author), then you should speak with the supervisor before starting. Tell her why you want to be the first author.
This said, if you took the leading position as an experienced researcher you might be the first author without asking for it (unless alphabetical ordering took place).
Why not see this as an opportunity to supervise an able student? Prod them, needle them, cajole them. Do whatever it takes to get the student to generate a good result. It seems to me your adviser is giving you an opportunity to grow your professional capabilities.
If the master's student does all the research work, then they should be first author.
Authorship is always controversial, but the general rule is: Contribution of authors determines the order of the authors on the scholarly publications. The first author is the one who has contributed the most and usually writes the paper. The last author is usually a professor or senior researcher who leads the team, and his role is almost supervisory.
In your case, how significant was your idea to produce outputs? If you had a significant idea, you have designed the research. Even if the MS student has made many experiments, you can make a contribution by writing and preparing the manuscript.
Finally, you can ask a senior researcher to judge between you, if still there is any controversy.