Least squares Problem with Non Negativity Constraints Let $\mathbf{x}=[x_1,\ldots,x_K]$. I have the following optimization problem:
\begin{array}{rl} 
\min \limits_{\mathbf{x}} & \| \mathbf{Ax}-\mathbf{b} \|^2 \\
\mbox{s.t.} &  x_k\ge 0, \forall k
\end{array}
Please I need your help to solve this problem.
Another thing: my main problem was 
\begin{array}{rl} 
\min \limits_{\mathbf{x}} & \| \mathbf{A'x}-\mathbf{b'} \|^2 \\
\mbox{s.t.} &  x_k\ge 0, \forall k &  \\ & \mathbf{x}^T \mathbf{1}=1 
\end{array}
Then I transformed it to the first problem by including the equality constraint in the objective function. Is it fine  to do so ?

The problem as written has no analytic solution for general $A$, $b$. (Yes, indeed, there are exceptions. If the solution of the same problem with the inequalities removed happens to produce a positive solution, then you've solved the original problem. But in the far more likely event that the inequality-free solution has negative entries, there is no analytic solution.)
In order to find the solution, you need either a quadratic programming engine or a second-order cone programming engine. 
But before you run such a solver, you have to convert it to the standard form the solver expects. For instance, the QP formulation of your problem is
\begin{array}{ll}
\text{minimize}_{x} & x^T A^TA x - 2b^T x + b^T b \\
\text{subject to} & \vec{1}^T x = 1 \\
                  &  x \geq 0 
\end{array}
The second-order cone version is a bit more complex:
\begin{array}{ll}
\text{minimize}_{t,x}   & t \\
\text{subject to} & \|A x - b \|_2 \leq t \\
                  & \vec{1}^T x = 1 \\
                  &  x \geq 0 
\end{array}
A modeling framework can help here, by eliminating the need to do this transformation yourself. For instance, the MATLAB package CVX can express your problem as follows:
cvx_begin
    variable x(n)
    minimize(sum_square(A*x-b))
    subject to
        sum(x) == 1
        x >= 0
cvx_end

Disclaimer: I wrote CVX. But you certainly don't have to use it. In MATLAB alone there are a wealth of other choices, including YALMIP and the QP solver in MATLAB's own Optimization Toolbox.
