I`d say it`s rather necessary than optional.
Our
problem lies not
in what to do but
in how to do it.
Our problem lies
in...but not
in....
I might be wrong, but I think that the preposition
in is necessary here.
Lie is an intransitive verb whose meaning is
to consist or have as a basis and it is often used with the preposition
in:
The strength of his performance lies in his training.
lie - Definitions from Dictionary.com