I kinda understand that I need to do $(x(n)+z)-z$ ($z$ being the noise)
There goes an engineering joke that is just "If you know you've got noise in your signal, why don't you just subtract it!".
It's a joke, because the main property of noise is that you do not know its value, so you cannot just subtract it!
I don't understand how to find the exact formula to find the noise when the noise itself is generated using
Exactly. That's because (if
rand is actually random), there is no formula.
So, you cannot subtract the noise like that completely.
What you can do is filter (and all the options you've been given are filters, or filter banks, with DFT being identical to the FFT, not quite sure you're fully grasping your assignment there)!
So, you want to build a filter that lets through nothing but your signal of interest – your 8 Hz sine wave.
(In the following: italics denote terms that your lecture most probably introduced. If you don't know them – look them up! Relevant to future understanding, and quite possibly to your grade.)
As you know (or should know, sounds like that was the whole point of the lecture), filtering is applying a linear system to a signal. And I'd recommend you consider a FIR first, so that filtering is just convolution of the signal with the impulse response of that filter (i.e. the filter coefficient vector gets convolved with the signal).
Because of linearity, you can look at how the convolution with that filter affects a) the pure signal and b) the pure noise, because if you add the results, you'll get the same as if you filtered signal added to noise.
So, you're looking for an impulse response that maximizes the amplitude of the sine passing through it. Convolution has a formula, and hint: if you use the same (just ever so slightly modified) as the thing you convolve with that you want to maximize, then you get a high amplitude.
This is as far as I want to do your homework.