How to calculate, *for a square wave input*, the cut-off frequency point for a basic RC low pass filter with
I think this question has some merit. Even though it is asked from the standpoint of not understading harmonic Fourier decomposition, it serves for a few mental exercises. First of all, to address the true goal of the question:


  I need to know how my circuit will behave with square input.


Square waves can be given by the summation of all odd harmonics of a fundamental sine wave. If the square wave is input to a linear system, then superposition principle applies, and the output signal can be reconstructed with the appropriate gain/attenuation and phase shift of each individual harmonic component.

For a matlab example, here is how to build a square wave using harmonic components up to 99th order:

t = 0:.01:20;
x = zeros(1,length(t));
for i = 1:2:99
    h = (1/i)*sin(i*t);
    x = x+h;
end
plot(t,x)




To find the output signal, if this wave is to be input of a RC filter, one could use the bode plot of the filter, find the attenuation and phase delay for every single harmonic component, and reconstruct the signal. A bode plot for an example filter:

sys = zpk([],-1,1);
bode(sys)




And the related system output:

lsim(sys,x,t)




Let's attempt to reconstruct the output using data from the bode diagram:

y = zeros(1,length(t));
for i = 1:2:99
    [MAG,PHASE] = bode(sys,i);
    PHASE = pi*PHASE/180;
    h = (MAG/i)*sin(i*t+PHASE);
    y = y+h;
end
plot(t,y)




Hope this covers the aspects of Fourier decomposition and Bode analysis. Now, to explain why the question has more merit than first meets the eye:


  How to do the same analysis as above (i.e. finding cutoff point) for a square input. I mean, what should I insert as f_c? Doesn't square wave contain all frequencies?


Cutoff point can be defined as the frequency in which the output signal has half the power of the input signal. For sine inputs, this equals the -3dB frequency. Sine power is proportional to amplitude squared, and -3dB equals a \$.707\$ attenuation, which when squared equals \$.5\$. But what is the power of a square wave? And at which frequency is the output signal half the power of the input? This stands as a separate question which is tangential to the problem, but can serve as a "fun" mathematical exercise.