Is there a formal definition for the difficulty of learning something? Sometimes I hear that one subject is harder than another, but never scientifically investigated. For example, in high school, it's commonly thought that mathematics is the hardest subject. But I think that this definition is poorly built. I remember when I was in high school, and mathematics wasn't hard, but I really had no interest, and I ignored it and obtained poor grades. Today I've started to like mathematics, and it's really not that hard. I can solve problems and prove propositions, and the only thing I feel that changed in my mind is the addition of interest. 

It seems that sometimes, the subject is not hard, and the student is under the effect of something that compels him to not do it, such as mathematical anxiety or the lack of interest as I pointed out before. I believe that the concept of difficulty per se is a poor measure of skill needed for doing something and that it interacts with other aspects. So, I got curious: are there studies on the definition of difficulty?

I have found this question after making my question, and it seems to address some of the questions I've made, but it doesn't mention the effects of willingness or lack of interest in obtaining knowledge.
First, let me start by saying your topic is extremely broad.  There are many reasons why something may be difficult to learn.  However, the exact "difficulty associated with learning something" is known by many different terms in the scientific literature, and in particular, I have found cognitive load theory to be a particularly useful description of this.  According to Sweller, Cognitive Load falls into three distinct domains:


Intrinsic cognitive load is that difficulty that is associated with the material itself, independent of the learner.
Extraneous cognitive load is associated with the instructional methods or materials (poor instructional techniques increase this load).
Germane cognitive load is load that the learner requires to create associations and connections among the concepts, and depends on the learner's knowledge base.


The basic premise is that subjects are difficult to learn if they require a great number of connections to be formed (a mental model or schema).  The greater the connections required, the greater the difficulty.  Complicating this, certain topics are inherently difficult, such as mathematical computation and critical thinking, and learners bring their own pre-conceived mental notions to the table.  Cognitive Load theory attempts to provide a framework for thinking about the interactions between these variables.

I have studied the difficulty with teaching/learning engineering subjects, such as statistics, variability, critical thinking, etc. using controlled experiments that attempt to hone in on the second and third aspects of CLT. Here is a link to a conference proceeding that I published on the subject; I have another paper in-work that I can't share until it is published- but so far, my results very much support CLT.

Interest can be a factor, because attention given to a learning subject will take away from the students' ability to process other cognitive loads. Likewise, anxiety can also be a factor.  Lots of research left to do in this field if you ask me, though - so expect these theories to develop substantially in the next 10-20 years.