I defended my master thesis successfully yesterday. Everything in my master thesis was written by me and there is no problem. However I'm a bit skeptical about one thing. So in my thesis I have a part that explains a very well known model. To explain the model you basically need to calculate the gradient of some function, and calculating the gradient is basically lengthy and spans many subsections. So there are many papers and I believe even books that show how to calculate the gradient step by step. So I found one paper and I read it and understood it and understood how the gradient of the function is derived. Next I compared the calculations in the paper to other books and I found that they are very similar.
Since I'm introducing the model in my thesis I had to explain how to calculate the gradient. I explain everything in my own words. However when I wrote the equations they look almost like a copy from the paper!! Since I had the same understanding, so the calculations just almost look the same. So I was really confused what to do about this. Since I want to include the derivation of gradient in my thesis and it looks almost the same from the paper. So I was wondering if this is plagiarism! Since I was skeptical, I checked that the equations also look somehow almost the same from other papers. So to make sure that I don't be held for any kind of plagiarism and credit the authors, I mention at the beginning of the section that starts to explain the model is that my following explanations are based on the explanation given in the paper, where I learned about the model. Calculating the gradient is kinda lengthy and spans couple subsections, so in the subsections I assumed that since I credited the authors at the beginning then I didn't credit them again later for the other derivations of the gradient.
Now my question, is what I did correct?! I mean they were only the derivations of the gradient, so they were equations and I can't just "rephrase" them!
I remember once asking one postdoc that I'm using a lot of equations from one paper and he said that I just need to credit the authors that I'm using the same notation, which what I did. However, when I look at the formulas I feel somehow uncomfortable, because they look like a copy from that paper. Should I be worried?!
I really tried to credit the authors and I cited the papers in many places where I was explaining the models. But only the look of those large chunks of equations seems like copying.
As I said earlier I defended my thesis today, so I just hope that I didn't do anything wrong with that because I really worked hard for my thesis and every single word is mine.
P.S what I know is that copying common knowledge is not plagiarism. So this was my assumption behind the calculation of the gradient. Because the derivation of the gradient is not a contribution and the derivation is done in many papers. (like the gradient of the log-likelihood of logistic regression).
So in short, suppose that calculation of the gradient of the log-likelihood of logistic regression is very lengthy in general. And I just copied the equations from a paper that does the derivation. However when I motivated Logistic regression in my thesis I said that my explanations in the next subsections are based on the explanation in the paper where I copied the equations from. Is that okay?