Why do we need to write the noise as randn(2,1)./sqrt(2*SNR) instead of randn(1,1)/sqrt(2)?
Not sure if this will help, but let me show how to generate a noisy signal of a desired SNR, assuming additive white Gaussian noise (AWGN) model with fixed signal power.

First the basic definition of SNR (signal to noise ratio) is :
$$ \text{SNR} = \frac{\sigma_x^2}{\sigma_v^2} $$ 

where ${\sigma_x^2}$ is the signal power based on a WSS random signal model, and ${\sigma_v^2}$ is therefore the noise power (which I take here as white Gaussian noise).

SNR can also be defined in decibells:
$$ \text{SNR}_{dB} = 10 \log_{10} \left( \frac{\sigma_x^2}{\sigma_v^2} \right) = 10 \log_{10}( \text{SNR}) $$ 

Assuming your signal power $\sigma_x^2$ is fixed, then you can adjust the noise power $\sigma_v^2$ to achieve a desired SNR with your AWGN signal model. The necessary noise power is found from required SNR as:

$$ \sigma_v^2 = \frac{ \sigma_x^2 }{ SNR } $$ 

Now, Matlab's built in Gaussian function randn() generates standard normal with zero mean and unit variance. Then to get a desired variance (hence noise power) you should scale it with the square root of the target power as shown:

sigx2  = 5.1;          % signal variance (power)
SNR    = 23 ;          % SNR = sigx^2 / sigv^2
sigv2  = sigx2 / SNR;  % noise variance (power)
N      = 1024;         % number of noise samples 
v = sqrt( sigv2 ) * randn(N,1); % White Gaussian noise


The reason why you multiply with the square root of the power (or variance) is based on the following property of the variance operator:

$$ \text{Var}(X) = \sigma_x^2  \implies \text{Var}(aX) = a^2 \sigma_x^2$$