We will now see how to analyze a simple task. To be able to develop a solution, solution which can then be reprogrammed. The task we are going to study, is the solution of a second degree equation. The first thing to do, is to completely understand the task at hand. What do we know about a second degree equation? It is known to be expressed as a. x plus bx plus equals zero. So the objective is to calculate for which value of x. This equation is valid. We know that to calculate the solution, we need to calculate a value called the discriminant which is frequently noted. Delta that the value of this discriminant is is calculated from the coefficients a, b and c of the delta equation. Its value is b²-4ac. From there, we know that we have three possible situations. These three possible situations will depend on the value of the discriminant. These three situations are: delta is strictly negative. Delta is equal to zero. Delta is strictly positive in the case where Delta is strictly negative. There is no solution. In the case where Delta is null, there is a solution, in fact a double solution. This solution? It is worth -b/2a. And in the situation Delta is strictly positive. Here we have two solutions, the so-called roots of the equation. x1 which is -b root of delta over two a and x2 which is minus b plus delta. Out of two a. And so the solutions are well according to the delta value. Either no solution, or a single value, or both values X1 and X2. Our program will have to deal with all situations. We are not going to write a program that will manage the situation where the discriminant is strictly negative. Another program where it is zero and a third program where it is strictly positive. So we need to consider a program, must deal with situations, all situations, general situations and also particular situations. So our goal here, is to find a solution that is general and therefore capable of to take into account all possible situations. How to analyze the problem to arrive at a solution? We remember that the writing of a program, it consists on the one hand to declare the data set in the form of of variables and then to write the set of instructions. Which will define the treatments that will be applied to these data. A first way to analyze the problem? It can be as simple as that. Identify what data you will need. These data are generally of three types. There will be the data that will have to be provided to the computer. In the program the result data and then possibly between the data input data, output data, result data. We will need intermediate data. What are the data here in our problem? The data we will need to provide at the beginning. Well the unknown data. That's a, b and c. The program will not be able to calculate them. The user must therefore be able to provide them to the program. So, we already identify three data three data to be provided as input. From there, the results are identified. We can see that we can find ourselves in three different situations no situation, so no results, only one result. So here we are going to place ourselves in the broadest, most general situation possible. We will identify the most general solution which will have two results. If we have one or no results, we will simply not use the two variables associated with the two roots solution so we will need of two additional data variables x1 x2 that will allow us to calculate the roots of the equation. And then, we see that between the definition of the equation and the calculation of the solutions, we need an intermediate value which is the value of the discriminant. So we will need a variable to calculate it. This variable we will call it Delta for example. We can see here that the names that we will give to the variable always give as a rule that the names that we will give to the variable either names that are meaningful. You will often be told not to call the variables ABC. But it turns out that here the way in which we to construct an equation is to use the coefficients a b and c. So the best practice is to use the same coefficients to be able to make the direct link between the equation we want to solve and the variables that we will use to solve it. Id. The two equations are often called the two solutions x1 x2. And then the discriminant, we often call it delta and so we will call our variable, for example delta, the name, the name of a variable is chosen by the programmer. The rule, is to try to give it a name that is as meaningful as possible in relation to the roles it will have within the program. So now we have defined, identified what the data are which we need the three coefficients, the two solution roots and the intermediate variable delta. What are the instructions now, the treatments to be carried out? Our treatment Here too, we can identify different parts. There will always be in a program a first part of initialization, that is to say that the data, and in particular the input data, will have to be initialized. Then we will proceed to the calculation of the data calculations of final results, and the display and transmission of these results to the user. So here are the data we will need to start the program. We will need a b and c are the minimum necessary data. This data cannot be calculated by the program. It will therefore be necessary for the user to provide them. So, from the first part of the solution, it will consist in making the user enter on the keyboard a, b and c . Once we know the values of a, b, c and we can see that in the order of solving a second order equation degree, the step to realize is the calculation of the discriminant of Delta. Delta depends on b, a, c. If you have already entered a, b and c, we have the necessary data to make the calculation of Delta. So the next step, it will consist in making this calculation and thus to compute b²-4ac. Once we have Delta, we see that the rest of the resolution will depend on the value of delta. We are therefore in a situation. Conditional. Which will depend on the value that will be found for Delta. So we will use conditional instructions. If Delta is strictly negative, then we won't have a solution. Yes, it is. Delta is equal to zero. So. A solution that is the solution. x1 = -b/2a and if Delta is strictly positive, then we have both solutions. That is to say x1 and x2, calculated according to this equation. Each time, we can see that it depends on b and a. The values have been entered beforehand, so we have all the values necessary to calculate X. In the second solution, x1 and x2, they depend on b, a and Delta, and we can see that we have entered b and a and that we have already calculated Delta. So we have all the necessary values to calculate x1 and x2. And then, once we've done the math, well, we'll have to post. The result. This means either indicating that there is no solution, or indicating the solution or indicate the two possible solutions. So there, we have just defined in a somewhat informal way a possible solution that builds progressively. The solution of our second degree equation. We have just seen how to perform the analysis of a simple task to identify a solution. In this solution we have. Characterize the variables. Input variables. Intermediate variables. The variables. Results. Then we identified the instructions, the necessary treatments and their scheduling. The next step is to code this solution. We will see in a next video how to go from the solution that we have just built to its coding and then to its testing.